var loadTime = 0;
var compTime = 0;
var center, groups, icons, subs, menus;
var ss_menus = JSON.parse(window.localStorage.getItem("backstage-access-permissionList"));
if ($("#scroll").length < 1) {
  $("#config_js").after('<script id="scroll" src="' + site.interUrl + '/js/jquery.nicescroll/jquery.nicescroll.min.js"></script>');
}
var ly = {
  /**
   *	获取url参数 
   */
  getUrlParam: function(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg); //匹配目标参数
    if (r != null) return decodeURI(r[2]);
    return null; //返回参数值
  },

  /**
   *	初始化目录数据 
   */
  getMenuData: function() {
    ly.getMenuType(ss_menus);
  },
  getMenuType: function(m) {
    groups = $.grep(m, function(c) {
      return c.level == 1;
    });
    subs = $.grep(m, function(c) {
      return c.level == 2;
    });
    menus = $.grep(m, function(c) {
      return c.level == 3;
    });
    var groupid = ly.getUrlParam("groupid") || '';
    var subid = ly.getUrlParam("subid") || '';
    var menuid = ly.getUrlParam("menuid") || '';
    ly.getMenuGroup(groupid);
    if (groupid) {
      ly.getSub(groupid, subid, menuid);
    } else {
      $(".left_menu").remove();
    }
  },
  /**
   *	获得组首页图标 
   */
  getMenuGroup: function(gid) {
    gid = gid || "001";
    var subid = '';
    var menuid = '';
    var g = '';
    $.each(groups, function(i, gt) {
      var sub = $.grep(subs, function(c) {
        subid = c.id;
        return c.parentId == gt.id;
      });
      if (sub.length > 0) {
        $.each(sub, function(k, q) {
          var a = false;
          var menu = $.grep(menus, function(me) {
            return me.parentId == q.id;
          });
          if (q.url != "" && q.url != undefined && menu.length < 1) {
            if (q.url.indexOf("?") > -1) {
              src = q.url.replace('{{interUrl}}', site.interUrl) + '&groupid=' + gt.id + '&subid=' + q.id;
            } else {
              src = q.url.replace('{{interUrl}}', site.interUrl) + '?groupid=' + gt.id + '&subid=' + q.id;
            }
          } else {
            $.each(menu, function(l, r) {
              if (l > 0) {
                return false
              }
              if (r.url != "" && r.url != undefined) {
                if (r.url.indexOf("?") > -1) {
                  src = r.url.replace('{{interUrl}}', site.interUrl) + '&groupid=' + gt.id + '&subid=' + q.id + '&menuid=' + r.id;
                } else {
                  src = r.url.replace('{{interUrl}}', site.interUrl) + '?groupid=' + gt.id + '&subid=' + q.id + '&menuid=' + r.id;
                }
                a = true;
                return false;
              } else {
                src = site.interUrl + "404.html"
              }
            });
          }
          if (a) {
            return false;
          }
        });
      } else {
        src = gt.url.replace('{{interUrl}}', site.interUrl) + '?groupid=' + gt.id;
      }
      if (gt.id == gid) {
        if (subid) {
          g += '<a href="' + src + '" class="active"><i class="iconfont ' + gt.icon + '"></i><span>' + gt.name + '</span></a>';
        } else {
          g += '<a href="' + src + '" class="active"><i class="iconfont ' + gt.icon + '"></i><span>' + gt.name + '</span></a>';
        }
      } else {
        if (subid) {
          g += '<a href="' + src + '"><i class="iconfont ' + gt.icon + '"></i><span>' + gt.name + '</span></a>';
        } else {
          g += '<a href="' + src + '"><i class="iconfont ' + gt.icon + '"></i><span>' + gt.name + '</span></a>';
        }
      }
    });
    $(".menu_groups").html(g);
    if (window.localStorage.getItem("groupEq") != "" && window.localStorage.getItem("groupEq") != null) {
      $(".menu_groups").find("a").eq(window.localStorage.getItem("groupEq")).addClass("active").siblings("a").removeClass("active");
    }
    $(".menu_groups").niceScroll({
      cursorcolor: "rgba(255,255,255,.1)",
      cursorwidth: "5px",
      cursorborderradius: 0,
      cursorborder: 0
    });
  },
  /**
   *	获得左侧菜单 
   */
  getSub: function(groupid, subid, menuid) {
    var m = "<dl>",
      src = "",
      s = "",
      hdsub = false,
      hdmenu = false;
    if (groupid != "") {
      var sub = $.grep(subs, function(ic) {
        return ic.parentId == groupid;
      });
      if (sub.length == 1) {
        hdsub = true;
      } else if (sub.length == 0) {
        hdsub = true;
        hdmenu = true;
      }
      $.each(sub, function(i, q) {
        if (q.id == subid) {
          s = "active";
        } else {
          s = "";
        }
        var menu = $.grep(menus, function(me) {
          return me.parentId == q.id;
        });
        if (menu.length <= 1) {
          hdmenu = true;
        }
        if (q.url != "" && q.url != undefined) {
          if (q.url.indexOf("?") > -1) {
			//   2019-1-8 10:30:58
            src = q.url.replace('{{interUrl}}', site.interUrl) + '&groupid=' + groupid + '&subid=' + q.id;
          } else {
            src = q.url.replace('{{interUrl}}', site.interUrl) + '?groupid=' + groupid + '&subid=' + q.id;
          }
        } else {
          $.each(menu, function(l, r) {
            if (r.url != "" && r.url != undefined) {
              if (r.url.indexOf("?") > -1) {
                src = r.url.replace('{{interUrl}}', site.interUrl) + '&groupid=' + groupid + '&subid=' + q.id + '&menuid=' + r.id;
              } else {
                src = r.url.replace('{{interUrl}}', site.interUrl) + '?groupid=' + groupid + '&subid=' + q.id + '&menuid=' + r.id;
              }
              return false;
            }
          });
        }
        if (menu.length > 0) {
          m += '<dt class="' + s + '"><a href="' + src + '" ><span>' + q.name + '</span></a></dt><dd>';
        } else {
          m += '<dt class="' + s + '"><a href="' + src + '" >' + q.name + '</a></dt><dd>';
        }
        $.each(menu, function(j, me) {
          if (me.url.indexOf("?") > -1) {
            src = me.url.replace('{{interUrl}}', site.interUrl) + '&groupid=' + groupid + '&subid=' + q.id + '&menuid=' + me.id;
          } else if (me.url != "") {
            src = me.url.replace('{{interUrl}}', site.interUrl) + '?groupid=' + groupid + '&subid=' + q.id + '&menuid=' + me.id;
          } else {
            src = site.interUrl + "404.html";
          }
          if (me.id == menuid) {
            s = "active";
          } else {
            s = "";
          }
          m += '<a href="' + src + '" class="' + s + '" >' + me.name + '</a>';
        });
        m += '</dd>';

      });
      $(".left_menu .sub").html(m + '</dl>');
    } else {
      $(".left_menu .sub").html("目录参数有误");
    }
    if ((hdsub && hdmenu) || $(".left_menu").length == 0) {
      $(".left_menu").hide();
      $(".btnBox").css("left", "198px")
    }
  },

  /**
   *	弹出轻量提示 toast
   */
  toast: function(text, url) {
    if (url) {
      window.sessionStorage.setItem("toast_text_access", text);
      if (url == "reload") {
        window.location.reload();
      } else if (url == "ignore") {} else {
        ly.goto(url);
      }
      return false;
    }
    if ($(".toastBox").length < 1) {
      $("body").append('<div class="toastBox"></div>');
    }
    if ($(".toasts").length < 1) {
      $(".toastBox").attr("d-toast", 0);
    } else {
      $(".toastBox").attr("d-toast", $(".toastBox").attr("d-toast") - (-1));
    }
    var j = $(".toastBox").attr("d-toast");
    var t = (j % 10) * 55;
    var i = "t" + j;
    var h = '<div class="toasts" style="top:' + t + 'px" id=' + i + '><span class="toast">' + text + '</span><div>';
    if ($("body").find(".toasts").length < 1) {
      $(".toastBox").append(h);
    }
    $("#" + i).animate({
      "height": "auto"
    }, 5000, function() {
      $(this).animate({
        "opacity": 0,
        "margin-top": -30
      }, 500, function() {
        $(this).remove();
      });
    });
  },
  /**
   *	弹出提示 alert
   */
  alert: function(m, c) {
    var h = '<div class="cover" id="syalert"><div class="ctr">            <div class="window"><div class="con">' + m + '</div><div class="btns"><button class="btn ok red">确定</button></div></div></div></div>';
    $("body").append(h);
    var w = $("body #syalert");
    w.find(".ok").focus();
    w.find(".con").html(m);
    $(window).keydown(function(e) {
      if (e.which == 27) {
        w.find(".ok").click();
      }
    });
    w.on("click", ".ok", function() {
      if (typeof(c) == 'function') {
        c();
      }
      $(this).parents("#syalert").fadeOut(200, function() {
        $(this).remove();
      });
    });
  },
  /**
   *	弹出确认框 confirm
   */
  confirm: function(m, c, b, t) {
    t = t || "确定,取消";
    var ot = t.split(",");
    var h = '<div class="cover" id="syalert"><div class="ctr"><div class="window"><div class="con">' + m + '</div><div class="btns"><button class="btn ok red">' + ot[0] + '</button></div></div></div></div>';
    $("body").append(h);

    var w = $("body #syalert");
    w.find(".ok").focus();
    w.find(".con").html(m);
    w.find(".btns").append(" <button class='btn cancel'>" + ot[1] + "</button>");
    $(window).keydown(function(e) {
      if (e.which == 27) {
        w.find(".cancel").click();
      }
    });
    w.on("click", ".ok", function() {
      if (typeof(c) == 'function') {
        c();
      }
      $(this).parents("#syalert").fadeOut(200, function() {
        $(this).remove();
      });
    });
    w.on("click", ".cancel", function() {
      if (typeof(b) == 'function') {
        b();
      }
      $(this).parents("#syalert").fadeOut(200, function() {
        $(this).remove();
      });
    });
  },
  /**
   *	跳转到页面 url：路径，b：新窗口
   */
  goto: function(url, b) {
    var u = url.match(/\{\{(.+?)\}\}/g);
    if (u != "" && u != undefined) {
      var um = u.toString();
      var up = um.substring(2, um.length - 2);
      var uu = site[up];
      url = url.replace(um, uu);
    }
    var obj = ly.parseQueryString(url);
    window.localStorage.setItem("group", ly.getUrlParam("groupid") || 1);
    window.localStorage.setItem("sub", ly.getUrlParam("subid") || 0);
    window.localStorage.setItem("menu", ly.getUrlParam("menuid") || 0);
    var g = obj.groupid || window.localStorage.getItem("group");
    var s = obj.subid || window.localStorage.getItem("sub");
    var m = obj.menuid || window.localStorage.getItem("menu");
    var r = 'groupid=' + g + '&subid=' + s + '&menuid=' + m;
    url = ly.delQueStr(url, "groupid");
    url = ly.delQueStr(url, "subid");
    url = ly.delQueStr(url, "menuid");
    if (b) {
      window.open(url);
    } else if (url.indexOf("login.html") > -1) {
      window.location.href = url;
    } else {
      if (url.match("[\?]")) {
        url = url + "&" + r;
      } else {
        url = url + "?" + r;
      }
      window.location.href = url;
    }
  },

  /**
   *	获取路径所有参数
   */
  parseQueryString: function(url) {
    var str = url.split("?")[1] || "";
    var iterms = str.split("&");
    var arr, json = {};
    for (var i = 0; i < iterms.length; i++) {
      arr = iterms[i].split("=");
      json[arr[0]] = arr[1];
    }
    return json;
  },
  /**
   * 删除参数值
   */
  delQueStr: function(url, ref) {
    var str = "";

    if (url.indexOf('?') != -1)
      str = url.substr(url.indexOf('?') + 1);
    else
      return url;
    var arr = "";
    var returnurl = "";
    var setparam = "";
    if (str.indexOf('&') != -1) {
      arr = str.split('&');
      for (i in arr) {
        if (arr[i].split('=')[0] != ref) {
          returnurl = returnurl + arr[i].split('=')[0] + "=" + arr[i].split('=')[1] + "&";
        }
      }
      return url.substr(0, url.indexOf('?')) + "?" + returnurl.substr(0, returnurl.length - 1);
    } else {
      arr = str.split('=');
      if (arr[0] == ref)
        return url.substr(0, url.indexOf('?'));
      else
        return url;
    }
  }
};

/**
 *	显示贴士（tips）
  */
$.fn.showTips = function (options) {
  var h = "",
    defaults = {
      text: "这是一个提示",
      type: "", //waring,error,success
      timeout: 0
    };
  var opts = $.extend({}, defaults, options);
  var i = "t" + parseInt(Math.random() * 10000);
  h += '<div class="tips ' + opts.type + '" id="' + i + '">';
  if (opts.timeout) {
    h += '<div class="timer"></div>';
  } else {
    h += '<div class="cls"><div class="iconfont icon-close"></div></div>';
  }
  h += '<div class="con">' + opts.text + '</div></div>';
  $(this).append(h);
  var wh = $("#" + i).height() + 20;
  $("#" + i).height(0);
  $("#" + i).animate({
    "height": wh
  }, 300, function () {
    $(this).height("auto");
  });

  $("#" + i).on("click", ".cls", function () {
    $(this).parents(".tips").animate({
      "height": 0,
      "padding": "0 20px"
    }, 300, function () {
      $(this).remove();
    });
  });
  if (opts.timeout) {
    $("#" + i).find(".timer").animate({
      "width": 0
    }, opts.timeout, function () {
      $(this).parents(".tips").animate({
        "height": 0,
        "padding": "0 20px"
      }, 300, function () {
        $(this).remove();
      });
    });
  }
};

/**
 *	显示加载
 */
$.fn.showloading = function(options) {
  var obj,
    defaults = {
      lid: "sy_loading",
      parent: false,
      timeout: 0,
      bgcolor: ""
    };
  var opts = $.extend({}, defaults, options);
  if (opts.parent) {
    obj = $("body");
  } else {
    obj = $(this) || $("body");
  }
  if (obj.css("position") != "absolute" && !obj.css("position") != "fixed") {
    obj.css("position", "relative");
  }
  var h = '<div class="loading" style="background-color:' + opts.bgcolor + ';" lid="' + opts.lid + '"><div class="loader-inner ball-spin-fade-loader"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>';
  var t = '' //'<div class="texter">' + ly.helpText() + '</div>';
  if (obj.selector == "body" || obj.selector == ".box") {
    h += t;
  } else {
    obj.find(".loader-inner").css("margin-top", 0);
  }
  if (obj.has(".loading").length > 0) {
    obj.find(".loading").remove();
  }
  obj.append(h + '</div>');
  if (opts.timeout) {
    setTimeout(function() {
      $("[lid=" + opts.lid + "]").remove();
      if (obj.css("position") == "relative") {
        obj.css("position", "static");
      }
    }, opts.timeout);
  }

};
/**
 *	关闭加载
 */
$.fn.hideloading = function(options) {
    if (loadTime == compTime) {
      $(".whiteboard").remove();
      var obj,
        defaults = {
          lid: "sy_loading",
          parent: false
        }
      var opts = $.extend({}, defaults, options);
      if (opts.parent) {
        obj = window.parent.$("body");
      } else {
        obj = $(this) || $("body");
      }
      obj.find("[lid=" + opts.lid + "]").fadeOut(500, function() {
        obj.find("[lid=" + opts.lid + "]").remove();
        if (obj.css("position") == "relative") {
          obj.css("position", "static");
        }
      });
    };
  }
  // $("body").showloading({lid:"bodyloading"});

  ~(function($) {
    var toastTxt = window.sessionStorage.getItem("toast_text_access");
    if (toastTxt) {
      ly.toast(toastTxt);
      window.sessionStorage.removeItem("toast_text_access");
    }
    // $("body").hideloading({	lid:"bodyloading"});

    /**
     *	选项卡插件
     */
    $.fn.fTabs = function(options) {
      var defaults = {
        switchingMode: "click",
        showItem: 0,
        tabObj: ".tabs li",
        activeClass: "active",
        boxObj: ".box",
        usePt: false,
        success: "",
        beforeChange: "",
        afterChange: ""
      };
      var opts = $.extend({}, defaults, options);
      var obj = $(this);
      if (opts.usePt) {
        obj.find(opts.tabObj + "[pt=" + opts.showItem + "]").addClass(opts.activeClass);
        obj.find(opts.boxObj).hide();
        obj.find(opts.boxObj + "[pt=" + opts.showItem + "]").fadeIn(100);
      } else {
        obj.find(opts.tabObj).eq(opts.showItem).addClass(opts.activeClass);
        obj.find(opts.boxObj).hide().eq(opts.showItem).fadeIn(100);
      }
      var total = obj.find(opts.tabObj).length;
      if (typeof(opts.success) == "function") {
        var index = opts.showItem;
        opts.success(index, total);
      }
      obj.find(opts.tabObj).on(opts.switchingMode, function() {
        var prev = obj.find(opts.tabObj + ".active").index();
        var index = $(this).index();
        if (typeof(opts.beforeChange) == "function") {
          opts.beforeChange(index, prev, total);
        }

        obj.find(opts.tabObj).removeClass(opts.activeClass);
        $(this).addClass(opts.activeClass);
        obj.find(opts.boxObj).hide();
        if (opts.usePt) {
          var j = $(this).attr("pt");
          obj.find(opts.boxObj + "[pt=" + j + "]").fadeIn(100);
        } else {
          obj.find(opts.boxObj).eq($(this).index()).fadeIn(100);
        }

        if (typeof(opts.afterChange) == "function") {
          opts.afterChange(index, prev, total);
        }
      });
    };

    /**
     *	图片剪裁上传
     */
    $.fn.imgUploader = function(options) {
      var _this = $(this),
        defaults = {
          size: "320,180", //默认尺寸
          prebox: $(this).attr("class")
        };
      var opts = $.extend({}, defaults, options),
        wh = opts.size.split(","),
        wa,
        ha,
        b = opts.prebox;
      if (wh[0] >= 500) {
        wa = (parseInt(wh[0]) * 2 + parseInt(20) + 40);
        ha = (parseInt(wh[1]) * 1 + parseInt(74) + 40);
      } else {
        wa = (parseInt(wh[0]) * 2.5 + parseInt(20) + 40);
        ha = (parseInt(wh[1]) * 1.5 + parseInt(74) + 40);
      }

      _this.after('<div class="cover"><div class="ctr"><div class="imguploader" style="width:' + wa + 'px; height:' + ha + 'px"><div class="t">编辑并上传图片<div class="cls"><div class="iconfont icon-close"></div></div></div><div class="c"></div></div></div></div>');
      var obj = _this.next(".cover");
      obj.find(".c").html('<iframe style="height:' + (ha - 34) + 'px" src="'+ site.interUrl +'/js/imguploader/index.html?w=' + wh[0] + '&h=' + wh[1] + '&b=' + b + '" frameborder="0"></iframe>');
      obj.hide();
      _this.find("span.up").click(function() {
        obj.show();
        $(".right_con").css("overflow", "hidden");
      });
      obj.find(".cls").click(function() {
        close();
        return false;
      });
      var close = function() {
        obj.hide();
        $(".right_con").css("overflow", "auto");
      };
    };

    /**
     *	阿里云视频上传组件
     *	创建时间：2017-10-12
     *	作者：fan.jin
     */

    $.fn.videoUploader = function() {
      var _this = $(this);
      _this.hide();
      pid = Uniquestring("viodeprv");
      _this.attr("prvbox", pid)
      _this.before('<div class="videobox"><span class="up"></span><span class="del"></span><span class="progress"><i></i><span></span></span><span class="process"><i></i></span></div>');
      if ($(this).attr("disabled") != undefined) {
        _this.prev(".videobox").html("").css("cursor", "no-drop");
      }
      _this.after('<div class="cover"><div class="ctr"><div class="imguploader video"><div class="t">视频上传<div class="cls"><div class="iconfont icon-close"></div></div></div><div class="c"></div></div></div></div>');
      var obj = _this.next(".cover");
      obj.hide();
      _this.find("span.up").click(function() {
        obj.show();
        $(".right_con").css("overflow", "hidden");
      });
      obj.find(".cls").click(function() {
        close();
        return false;
      });
      var close = function() {
        obj.hide();
        $(".right_con").css("overflow", "auto");
        if (_this.prev(".videobox").hasClass("active")) {
          obj.find("iframe").attr("src", obj.find("iframe").attr("src"));
        }
      };
      var v = _this.attr("aliid") || "";
      if (v != "") {
        _this.prev(".videobox").addClass("active");
        var bg = _this.attr("cover");
        _this.removeAttr("cover");
        if (bg != "" && bg != undefined) {
          _this.prev(".videobox").css("background-image", "url(" + bg + ")");
        }
      }
      _this.prev(".videobox").children(".up").click(function() {
        _this.next(".cover").show();
        v = _this.attr("aliid") || "";
        var b = _this.attr("prvbox");
        obj.find(".c").html('<iframe style="height:480px" src="../../js/videouploader/videouploader.html?v=' + v + '&b=' + b + '" frameborder="0"></iframe>');
      });
      _this.prev(".videobox").children(".progress").click(function() {
        _this.next(".cover").show();
      });
      _this.prev(".videobox").children(".del").click(function() {
        deleteVideo();
      });
      var deleteVideo = function() {
        _this.val("");
        _this.removeAttr("aliid");
        _this.prev(".videobox").removeClass("active");
        _this.prev(".videobox").removeAttr("style");
      };
    };
  })(jQuery);

/**
 *	删格化布局间距——封装方法
 */
function addGutter() {
  $("[gutter]").each(function() {
    var m = $(this).attr("gutter") || 0;
    var w = $(this).width();
    $(this).children().css({
      "padding-left": m / 2,
      "padding-right": m / 2
    });
    $(this).css({
      "margin-left": -m / 2,
      "margin-right": -m / 2
    });
    $(this).children().children("span.address,span.date,span.unit").css({
      "right": m / 2
    })
  });
}

/**
 *	显示提示文字
 */
var setPoint = function() {
  $("[point]").each(function() {
    var c;
    if ($(window).width() - $(this).offset().left - $(this).width() < 300) {
      c = "left";
    } else {
      c = "";
    }
    $(this).find(".point").remove();
    $(this).append('<div class="point ' + c + '">' + $(this).attr("point") + '</div>');
    var h = $(this).find(".point").height();
    $(this).find(".point").attr("h", h); //.hide();
    if (($(window).height() - $(this).offset().top) < h) {
      $(this).find(".point").css({
        "top": "auto",
        "bottom": "0"
      }).addClass("bottom");
    }
    $(this).hover(function() {
      $(this).css("position", "relative")
      $(this).children(".point").show();
    }, function() {
      $(this).css("position", "static")
      $(this).children(".point").hide();
    });
  });
}
setPoint();
/**
 *	按钮列表
 */
function setBtn() {
  $(".btnlist").each(function() {
    var obj = $(this);
    var cl = obj.find(".btnbox").children().length;
    if (obj.find(".btnbox").length > 0) {
      for (var i = 0; i < cl; i++) {
        console.log(obj.find(".btnbox").children().eq(0));
        obj.append(obj.find(".btnbox").children().eq(0).remove());
      }
      obj.find(".btnbox").remove();
      obj.find(".slt").remove();
    }
    var l = obj.children().length;
    var h = (l - 1) * 34;
    var r = window.location.search.substr(1);
    var u;
    obj.find("a").each(function() {
      if ($(this).attr("href").indexOf(".html") > 0) {
        u = $(this).attr("href");
        if (u.match("[\?]")) {
          $(this).attr("href", u + "&" + r);
        } else {
          $(this).attr("href", u + "?" + r);
        }
      }
    });
    if (l > 1) {
      obj.append('<div class="btnbox"></div>');
      obj.append('<div class="slt"></div>');
      for (var i = 1; i < l; i++) {
        obj.children(".btnbox").append(obj.children().eq(1).remove());
      }
      obj.find(".slt").click(function() {
        if (!$(this).hasClass("clt")) {
          obj.find(".btnbox").animate({
            "height": h
          }, 200, function() {
            obj.find(".slt").addClass("clt");
          });
        } else {
          obj.find(".btnbox").animate({
            "height": 1
          }, 200, function() {
            obj.find(".slt").removeClass("clt");
          });
        }
      });
      $("body").click(function() {
        if (obj.find(".slt").hasClass("clt")) {
          obj.find(".btnbox").animate({
            "height": 1
          }, 200, function() {
            obj.find(".slt").removeClass("clt");
          });
        }
      });
    } else {
      obj.children().css("padding-right", 0);
    }
  });
}
setBtn();

var setVideoUploader = function() {
  $("input[type=upvideo]").each(function() {
    $(this).videoUploader({

    });
  });
};
/**
 *	复选框
 */
$("label.chk").each(function() {
  var obj = $(this);
  if (obj.find('b').length == 0) {
    obj.find("[type=checkbox]").after("<b></b>");
  }
});
/**
 *	单选框
 */
$("label.rad").each(function() {
  var obj = $(this);
  if (obj.find('b').length == 0) {
    obj.find("[type=radio]").after("<b></b>");
  }
});
/**
 *	防止表单按回车提交,并只触发主按钮
 */
$("form").prepend("<input type='text' style='display:none'></input>");
$(".btn").each(function() {
  if (typeof($(this).attr("type")) == "undefined") {
    $(this).attr("type", "button");
  }
});
$("form").keydown(function(e) {
  if (e.which == 13) {
    $("form").find(".btn[main]").click();
    return false;
  }

});
/**
 *	列表选择
 */
$(".datalist").on("click", "td:not(:has(label))", function() {
  var _this = $(this);
  _this.parents("tr").find("input[type=checkbox]").click();
  var chk = _this.parents("tr").find("input[type=checkbox]");
  var n = chk.attr("name");
  var c = $("input[name='" + n + "']:checked").length;
  var a = $("input[name='" + n + "']").length;
  if (c == a) {
    $("input[data-for='" + n + "']").prop("checked", true);
  } else {
    $("input[data-for='" + n + "']").prop("checked", false);
  }
});
/**
 *	列表全选
 */
$(".chk.all input").on("click", function() {
  var n = $(this).attr("data-for");
  if ($(this).is(":checked")) {
    $(this).parents(".datalist").find("table").find("input[name='" + n + "']").prop("checked", true);
    //判断禁用
    var _disabled = $(this).parents(".datalist").find("table").find("input[name='" + n + "']");
    $(_disabled).each(function() {
      if ($(this).prop("disabled") == true) {
        $(this).prop("checked", false);
      }
    });
  } else {
    $(this).parents(".datalist").find("table").find("input[name='" + n + "']").prop("checked", false);
  }
});

/**
 *	显示/隐藏容器
 */
$("[toggle]").each(function() {
  var o = $($(this).attr("toggle"));
  var w = $(this).attr("toggletext").split(",");
  var p = $(this).attr("open");
  o.attr("data-height", o.outerHeight());
  if ($(this).attr("open") != "open") {
    o.css({
      "height": 0,
      "padding-top": 0,
      "padding-bottom": 0,
      "overflow": "hidden"
    });
  } else {
    $(this).html(w[1]);
  }
  $(this).click(function() {
    if (o.height() == 0) {
      $(this).html(w[1]);
      $(".right_con").animate({
        scrollTop: $(this).offset().top - 150
      }, 300);
      o.animate({
        "height": o.attr("data-height")
      }, 300, function() {
        $(this).css({
          "height": "auto",
          "overflow": "visible"
        }).removeAttr("style");
      });
    } else {
      $(this).html(w[0]);
      o.animate({
        "height": 0,
        "padding-top": 0,
        "padding-bottom": 0
      }, 300, function() {
        $(this).css({
          "overflow": "hidden"
        })
      });
    }
  });
});
/**
 *	日期控件触发验证
 */
var tovalid = function(e) {
  e.elem.blur();
}
$.fn.tovalid = function(e, o) {
  setTimeout(function() {
    $(this.elem).blur();
  }, 50)
}
/**
 *	日期控件
 */
$.fn.createDateor = function(options) {
  var defaults = {
    type: "date",
    range: false,
    maxDate: null,
    minDate: null,
    isToday: false
  }
  var _this = $(this);
  var opts = $.extend({}, defaults, options);
  var oldDate = '';
  var fmt;
  switch (opts.type) {
    case "date":
      fmt = "yyyy-MM-dd";
      break;
    case "datetime":
      fmt = "yyyy-MM-dd HH:mm:ss";
      break;
    case "time":
      fmt = "HH:mm:ss";
      break;
    case "month":
      fmt = "yyyy-MM";
      break;
    case "year":
      fmt = "yyyy";
      break;
    default:
      fmt = "yyyy-MM-dd";
      break;
  }
  var icon = opts.type == "time" ? "time" : "date";
  if ($("#laydatejs").length < 1) {
    $("#config_js").after('<script id="laydatejs" src="' + site.interUrl + '/js/laydate/laydate.js"></script>');
  }
  _this.prop("readonly", true);
  _this.prop("type", "text");
  if (_this.parent().css("position") != "absolute" && !_this.parents().css("position") != "fixed") {
    _this.parent().css({
      "position": "relative",
      "font-size": "0"
    });
  }
  _this.after('<span class="' + icon + '"></span>');
  dv = _this.attr("isinitVal") == undefined ? false : true;
  if (opts.type == "time" && !opts.rang) {
    laydate.render({
      elem: _this.get(0),
      type: 'time',
      theme: "molv",
      format: fmt,
      ready: function(date) {
        oldDate = _this.val().replace(/-/g, '');
      },
      done: function(i, d) {
        var currDate = i.replace(/-/g, '');
        if (i != oldDate) {
          boolean = true;
        }
        setTimeout(function() {
          $(_this).blur();
        }, 50)
      }
    });
  } else if (opts.range) {
    // laydate.render({
    // 	elem:_this.get(0),
    // 	theme:"molv",
    // 	format: fmt,
    // 	btns: ['clear','confirm'],
    // 	type:opts.type,
    // 	trigger: 'click',
    // 	range: '到',
    // 	max: dateConversion(opts.maxDate, "max"),
    // 	min: dateConversion(opts.minDate, "min"),
    // 	done: function (val,dates) {
    // 		setTimeout(function(){
    // 			$(_this).blur();
    // 		},50)
    // 	}
    // });

    var start = laydate.render({
      elem: _this.get(0),
      theme: "molv",
      format: fmt,
      btns: ['clear', 'confirm'],
      type: opts.type,
      trigger: 'click',
      max: dateConversion(opts.maxDate, "max"),
      min: dateConversion(opts.minDate, "min"),
      ready: function(date) {
        oldDate = _this.val().replace(/-/g, '');
      },
      done: function(val, dates) {
        var currDate = val.replace(/-/g, '');
        if (val != oldDate) {
          boolean = true;
        }
        var dmin = this.min;
        if (val != "") {
          $.each(end, function(i, m) {
            m.config.min = {
              year: dates.year,
              month: dates.month - 1, //关键
              date: dates.date,
              hours: dates.hours,
              minutes: dates.minutes,
              seconds: dates.seconds
            };
          });
        } else {
          $.each(end, function(i, m) {
            m.config.min = dmin;
          });
        }
        setTimeout(function() {
          $(_this).blur();
        }, 50)
      }
    });
    var ed = _this.attr("relation");
    ed = ed.split(",");
    var end = [];
    $.each(ed, function(i, m) {
      end[i] = laydate.render({
        elem: $(m).get(0),
        theme: "molv",
        format: fmt,
        btns: ['clear', 'confirm'],
        type: opts.type,
        max: dateConversion(opts.maxDate, "max"),
        min: dateConversion(opts.minDate, "min"),
        ready: function(date) {
          oldDate = _this.val().replace(/-/g, '');
        },
        done: function(val, dates) {
          var currDate = val.replace(/-/g, '');
          if (val != oldDate) {
            boolean = true;
          }
          var dmax = this.max;
          if (val != "") {
            start.config.max = {
              year: dates.year,
              month: dates.month - 1,
              date: dates.date,
              hours: dates.hours,
              minutes: dates.minutes,
              seconds: dates.seconds
            }
          } else {
            start.config.max = dmax;
          }
          setTimeout(function() {
            $(m).blur();
          }, 50)
        }
      });
    });
  } else if (_this.attr("trigger") != undefined) {
    return false;
  } else {
    laydate.render({
      elem: _this.get(0),
      theme: "molv",
      format: fmt,
      btns: ['clear', 'confirm'],
      type: opts.type,
      max: dateConversion(opts.maxDate, "max"),
      min: dateConversion(opts.minDate, "min"),
      ready: function(date) {
        oldDate = _this.val().replace(/-/g, '');
      },
      done: function(i, d) {
        var currDate = i.replace(/-/g, '');
        if (i != oldDate) {
          boolean = true;
        }
        setTimeout(function() {
          $(_this).blur();
        }, 50)
      }
    });
  }
}
var setDateinput = function() {
  //日期至日期
  $("input[type=datetime],input[type=date],input[type=year],input[type=month],input[type=time]").each(function() {
    var _this = $(this);
    var max = _this.attr("maxdate") || null;
    var min = _this.attr("mindate") || null;
    var range = _this.attr("relation") == undefined || _this.attr("relation") == "" ? false : true;
    _this.createDateor({
      type: _this.attr("type"),
      range: range,
      maxDate: max,
      minDate: min,
      isToday: false
    })
  });
}
setDateinput();

function dateConversion(dt, type) {
  var ndt;
  if (dt == "today") {
    var now = new Date();
    ndt = type == "max" ? dateFormat(now, "yyyy-MM-dd HH:mm:ss") : dateFormat(now, "yyyy-MM-dd HH:mm:ss")
  } else if (dt == "thisyear") {
    var now = new Date();
    var firstDate = new Date(now.getFullYear(), 0, 1);
    var lastDate = new Date(now.getFullYear(), 11, 31);
    ndt = type == "max" ? dateFormat(lastDate, "yyyy-MM-dd 23:59:59") : dateFormat(firstDate, "yyyy-MM-dd 00:00:00");
  } else if (dt == "thismonth") {
    var now = new Date();
    var firstDate = new Date(now.getFullYear(), now.getMonth(), 1);
    var currentMonth = now.getMonth();
    var nextMonth = currentMonth + 1;
    var nextMonthFirstDay = new Date(now.getFullYear(), nextMonth, 1);
    var oneDay = 1000 * 60 * 60 * 24;
    var lastDate = new Date(nextMonthFirstDay - oneDay);
    ndt = type == "max" ? dateFormat(lastDate, "yyyy-MM-dd 23:59:59") : dateFormat(firstDate, "yyyy-MM-dd 00:00:00");
  } else if (dt != undefined && dt.split(",")[0] == "today") {
    var now = new Date();
    now.setDate(now.getDate() + parseInt(dt.split(",")[1]));
    ndt = type == "max" ? dateFormat(now, "yyyy-MM-dd HH:mm:ss") : dateFormat(now, "yyyy-MM-dd HH:mm:ss")
  } else {
    ndt = dt;
  }
  ndt = type == "max" ? ndt ? ndt : "9999-12-31 23:59:59" : ndt ? ndt : "1900-01-01 00:00:00";
  return ndt;
}

/**
 *	图片上传
 */
$("[ly-type=upimg]").each(function() {
  var _this = $(this);
  var size = _this.attr("upsize");
  var preview = _this.attr("prvbox");
  var h = '<span class="up"></span><span class="del"></span>';
  if ($(this).hasClass("required")) {
    $(this).removeClass("required");
    var pd = $(this).attr("placeholder");
    var dt = $(this).attr("data-tip");
    var dv = $(this).attr("data-valid");
    var de = $(this).attr("data-error");
    h += '<input type="hidden" class="required" placeholder="' + pd + '" data-tip="' + dt + '" data-valid="' + dv + '" data-error="' + de + '" >';
  } else {
    h += '<input type="hidden">';
  }
  h += '<div class="imgbox"></div>';
  _this.append(h)
  if (_this.attr("disabled") != undefined) {
    _this.css("cursor", "no-drop");
    _this.find(".up").hide();
    _this.find(".del").hide();
  } else {
    _this.imgUploader({
      size: size,
      prebox: preview
    });
  }
});
//清空图片
$("[ly-type=upimg]").find("span.del").click(function() {
  var oldVal = $(this).parents("[ly-type=upimg]").find("input").val();
  $(this).parents("[ly-type=upimg]").removeClass("active").find(".imgbox").html("");
  $(this).parents("[ly-type=upimg]").find("input").val("");
  var newVal = $(this).parents("[ly-type=upimg]").find("input").val("");
  if (oldVal != newVal) {
    boolean = true;
  }
  ly.toast("已清空图片");
});
/**
 *	页面跳转
 */
$("body").on("click", "[goto]", function() {
  url = $(this).attr("goto");
  ly.goto(url);
});
/**
 *	下拉链接菜单插件
 *	创建时间：2017-08-02
 */

$.fn.syMenu = function(options) {
  var defaults = {
    menuName: "菜单名",
    target: "",
    list: []
  };
  var opts = $.extend({}, defaults, options);
  var obj = $(this);
  obj.append('<span>' + opts.menuName + '</span>');
  obj.addClass("sy_menu").append('<i class="iconfont icon-xiala"></i><div class="sub"></sub>');
  var m = '';
  for (var i = 0; i < opts.list.length; i++) {
    if (opts.list[i].text !== "--") {
      var src = opts.list[i].href.replace('{{interUrl}}', site.interUrl);
      if (opts.target) {
        m += '<a href="' + src + '" target="' + opts.target + '">' + opts.list[i].text + '</a>';
      } else {
        m += '<a href="' + src + '">' + opts.list[i].text + '</a>';
      }
    } else {
      m += '<span class="line"></span>';
    }
  }
  obj.find(".sub").html(m);
  obj.on("click", ".sub a", function() {
    obj.find(".sub").hide();
  });
  obj.on("mouseover", function() {
    obj.find(".sub").show();
  });
  obj.on("mouseout", function() {
    obj.find(".sub").hide();
  });
};
/**
 *	操作按钮
 */
$.fn.getOper = function() {
  $(".operation").each(function() {
    if ($(this).children("em").length < 1) {
      $(this).append("<em></em>");
    }
    var obj;
    $(this).find("em").unbind("click");
    $(this).find("em").click(function() {
      obj = $(this);
      if (!obj.hasClass("open")) {
        obj.parents("tr").siblings("tr").find(".operlist").hide();
        obj.parents("tr").siblings("tr").find(".open").removeClass("open");
        obj.prev(".operlist").show();
        obj.addClass("open");
      } else {
        obj.prev(".operlist").hide();
        obj.removeClass("open");
      }
    });
    $(this).click(function() {
      return false;
    });
    $("body").click(function() {
      $(".operlist").hide();
      $(".operation").find("em").removeClass("open");
    });
    $(this).find(".menulist").each(function() {
      var mh = $(this).height();
      var ob = $(window).height() - $(this).offset().top;
    });
    $(this).find("[goto]").click(function() {
      url = $(this).attr("goto");
      ly.goto(url);
    });
  });
};
$(".datalist").getOper();

var ajaxStatus = true;
/**
 * 方法说明：(表单请求)ajax封装
 * @param {Object} url      请求路径
 * @param {Object} loading  是否加载动画： true|false
 * @param {Object} data     请求参数：例如{"id":1}
 * @param {Object} ajaxform     请求参数 true | false
 * @param {Object} success  回调函数 或者 回调函数名
 * @param {Object} type     请求类型
 * @param {Object} cache    浏览器历史缓存
 * @param {Object} alone    独立提交（一次有效的提交）
 * @param {Object} async    异步请求  ： true | false
 * @param {Object} dataType 接收数据类型  json
 * @param {Object} error    错误处理
 */
function ajax(options) {
  var isloading = options.loading || true;
  //console.log(isLoading);
  if ($(".waiting").length == 0 && isloading) {
    $("body").showloading({ lid: "ajaxloading", lock: false });
  }
  loadTime++;
  var accessToken = window.localStorage.getItem("backstage-access-token") || '';
  // if (accessToken == null || accessToken == '') {
  //   ly.alert("您未登录或登录超时,请重新登录", function() {
  //     window.location.href = site.interUrl + "login.html";
  //   })
  //   return false;
  // }
  /**
   * 权限判断
   * 2019-2-25
   */
  // var accessRole = JSON.parse(window.localStorage.getItem("backstage-access-role")) || '';
  // if (accessRole != null || accessRole != '') {
  //   // var limitsArr = [];
  //   for (var i = 0; i < accessRole.length; i++) {
  //     // limitsArr.push(accessRole[i].role.limits)
  //     var limitsArr = accessRole[i].role.limits;
  //     for (var j = 0; j < limitsArr.length; j++) {
  //       if (options.url.indexOf(limitsArr[j].limits.url) > -1) {
  //         ajaxStatus = false;
  //       }
  //     }
  //   }
  // }
  // if (!ajaxStatus){
  //   ly.alert('您没有该权限', function() {
  //     $(".loading").remove();
  //     $(".whiteboard").remove();
  //   });
  //   return false;
  // }
  var ajaxform = options.ajaxform || false;
  var type = options.type || 'post';
  var dataType = options.dataType || 'json';
  var contentType = options.contentType || 'application/x-www-form-urlencoded; charset=UTF-8';
  var async = options.async || true;
  var alone = options.alone || false;
  var cache = options.cache || false;
  var success = function(data) {
    if (typeof(options.callback) == 'function') {
      if (data.refreshToken != undefined) {}
      options.callback(data);
    }
  };
  var error = error || function(data) {
    $(".btnBox").find(".btn").prop("disabled", false);
    if (data.status == 404) {
      ly.toast('[' + data.status + ']服务器繁忙');
    } else if (data.status == 503) {
      ly.toast('[' + data.status + ']服务器繁忙');
    } else if (data.status == 0) {
      ly.toast('[' + data.status + ']服务器繁忙');
    } else if(data.responseText && JSON.parse(data.responseText).code == "user.is.null") {  //登录过期
      if(typeof(options.notLogin) === "function") {
        options.notLogin(JSON.parse(data.responseText).desc);
     } else {
        ly.alert(JSON.parse(data.responseText).desc, function() {
          var thisPage = window.location.href;
          window.location.href = site.interUrl + "login.html?pageUrl=" + thisPage;
       });
      }
    } else {
      ly.toast('[' + data.status + ']服务器繁忙');
    }
    ajaxStatus = true;
  };
  /*判断是否可以发送请求*/
  if (!ajaxStatus) {
    return false;
  }
  ajaxStatus = false; //禁用ajax请求
  /*正常情况下1秒后可以再次多个异步请求，为true时只可以有一次有效请求（例如添加数据）*/
  if (!alone) {
    ajaxStatus = true;
  }
  var reqObj = {
    'headers': {
      // 'access-token': accessToken,
      'ClientIdentity_MT': '_PC',
      'token': accessToken
    },
    'complete': function() {
      compTime++;
      if (loadTime == compTime) {
        if ($(".waiting").length > 0) {
          $(".waiting").fadeOut(200);
          $(".waiting").remove();
        }
        if ($(".loading").length > 0) {
          $("body").hideloading({
            lid: "ajaxloading"
          });
        }
      }
    },
    'url': options.url,
    'data': options.data,
    'type': type,
    'dataType': dataType,
    'contentType': contentType,
    'async': async,
    'success': success,
    'error': error,
    'jsonpCallback': 'jsonp' + (new Date()).valueOf().toString().substr(-4),
    'beforeSend': function() {},
  };
  if (ajaxform) {
    reqObj.data = JSON.stringify(options.data);
    reqObj.contentType = "application/json;charset=UTF-8";
  }
  $.ajax(reqObj);
}

// ajax提交(默认get方式提交)
function request(options) {
  ajax(options);
}
// ajax提交(post方式提交)
function requestPost(url, data, success, type, cache, alone,isLoad) {
	ajaxMenu(url, data, success, type || "get", cache, alone, false, 'json','',isLoad);
}
/**
 *	ajax封装
 *	创建时间：2017-08-22
 *	作者：fan.jin
 */
var ajaxStatus = true;
// ajax封装
function ajaxMenu(url, data, successed, type, cache, alone, async, dataType, error,isLoad) {
	// console.log(async);
	var isLoad = isLoad || true; //是否加载load动画
	if(isLoad!="noReLoad"){
		$("body").showloading({
			lid:"ajaxloading"
		});
	}
	loadTime ++;
	var accessToken = window.localStorage.getItem("backstage-access-token")||'';
	var type = type || 'post'; //请求类型
	var dataType = dataType || 'json'; //接收数据类型
	var async = async || true; //异步请求
	var alone = alone || false; //独立提交（一次有效的提交）
	var cache = cache || false; //浏览器历史缓存
	var success = function (data) {
		if (typeof (successed) == 'function') {//回调方法
			if(data.refreshToken!=undefined){
				window.localStorage.setItem("backstage-access-token",data.refreshToken);
			}
			successed(data);
		}
	};
	
	/*判断是否可以发送请求*/
	if (!ajaxStatus) {
		return false;
	}
	ajaxStatus = false; //禁用ajax请求
	/*正常情况下1秒后可以再次多个异步请求，为true时只可以有一次有效请求（例如添加数据）*/
	if (!alone) {
		ajaxStatus = true;
	}
	$.ajax({
		'headers': {
      'ClientIdentity_MT': '_PC',
      'token': accessToken
		},
		'complete':function(){
			compTime ++;
			if (loadTime == compTime) {
				$("body").hideloading({
					lid:"ajaxloading"
				});
			}
		},
		'url': url,
		'data': data,
		'type': type,
		'dataType': dataType,
		'async': async,
		'success': success,
		'error': error,
		'jsonpCallback': 'jsonp' + (new Date()).valueOf().toString().substr(-4),
		'beforeSend': function () {},
	});
}

/**
 *	数据列表
 */

$.fn.getList = function(options) {
  var search = {},
    screen = {},
    order = {},
    config = {},
    sz,
    pg = {};
  var opts = $.extend({}, options);
  var data = $.extend({}, opts.initData)
  if (opts == {}) {
    $(".tipbox").showTips({
      text: "表格配置有误，请检查表格配置",
      type: "error"
    });
    return false;
  }
  var doSearch = function(p) {
    $(".chk.all").find("input").prop("checked", false);
    var h = "";
    sz = window.localStorage.getItem(_this.attr("storage") + 'pageSize') || "10"; //获得表格分页数据
    var stgPage = window.sessionStorage.getItem(_this.attr("storage") + "pageNum");
    if (p) {
      window.sessionStorage.setItem(_this.attr("storage") + "pageNum", p);
    }
    _this.find(".pageSize").children(".ps").text(sz);
    data["page"] = p || stgPage || data.num || 1;
    data["pageSize"] = sz || opts.initData.size || 10;
    url = opts.url;
    var fullData = {};
    request({
      url: url,
      data: data,
      contentType: opts.contentType || '',
      ajaxform: opts.ajaxform || '',
      type: opts.type,
      callback: function(r) {
        var d = r.result;
        pg = d;
        if (r.code !== "success") {
          _this.find(".lbox").showTips({
            text: r.code + ":" + (r.desc || r.msg),
            type: "error"
          });
          ly.alert(r.desc || r.msg, function() {
            if (r.desc == "登录过期，请重新登录" || r.msg == "登录过期，请重新登录") {
              window.location.href = site.interUrl + "login.html" 
            } else if (r.desc == "错误的token" || r.msg == "错误的token") {
              window.location.reload();
            }
          })
          return;
        }
        if (d.list == undefined) {
          $(".tipbox").showTips({
            text: "数据结构有误，请检查数据list是否存在",
            type: "error"
          });
          return;
        }
        // if (d.list.length >= 5) {
        //   $("#bb1").hide();
        // }
        fullData = d.list;
        h += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr gutter = "20">';
        var cols = 0;
        if (opts.checkname != undefined && opts.checkname != "") { //选择列
          h += '<th class="w70">&nbsp;</th>';
          cols += 1;
        }
        $.each(opts.col, function(i, e) { //表头
          if (e.width != undefined && e.width != "") {
            st = "col-" + e.width;
          } else {
            st = "";
          }
          h += '<th class = "' + st + '">' + e.display + '</th>';
          cols += 1;
        });
        if (opts.option != undefined && opts.option != "") { //操作列
          h += '<th class="w70">操作</th>';
          cols += 1;
        }
        h += '</tr>';
        $.each(d.list, function(j, f) {
          h += '<tr gutter = "20">';
          if (opts.checkname != undefined && opts.checkname != "") {
            h += '<td><div class="chk"><input type="checkbox" name="' + opts.checkname + '" value = "' + f.id + '"';
            if (opts.checkattr != undefined && opts.checkattr != "") {
              $.each(opts.checkattr, function(k, g) {
                if (g.value != undefined && g.value != "") {
                  var item = g.value.split(","),
                    uu = new Array(),
                    gname = new Array(),
                    gattr = "";
                  $.each(item, function(a, z) {
                    uu[a] = z.match(/\{\{(.+?)\}\}/g);
                    if (uu[a] != "" && uu[a] != null) {
                      uu[a] = uu[a].toString()
                      gname[a] = uu[a].substring(2, uu[a].length - 2);
                      gattr += z.replace(uu[a], f[gname[a]]);
                    } else {
                      gattr = z;
                    }
                    if (a < item.length - 1) {
                      gattr += ",";
                    }
                  });
                  h += g.attr + '="' + gattr + '"';
                }
              });
            }
            h += '><b></b></div></td>';
          }
          $.each(opts.col, function(i, e) {
            var ff = getter(f, e.field) != undefined ? getter(f, e.field) : "";
            if (e.show != undefined && e.show !== "") {
              $.each(e.show, function(k, g) {
                if (ff == g.value) {
                  h += '<td>' + g.html + '</td>';
                }
              });
            } else if (e.fun != undefined && e.fun !== "") {
              h += '<td dofun="' + e.fun + '" row="' + j + '">' + ff + '</td>';
            } else {
              var bf = e.prefix || "";
              var af = e.suffix || "";
              h += '<td class="text-overflow">' + bf + ff + af + '</td>';
            }
          });
          if (opts.option != undefined && opts.option != "") { //操作列
            h += '<td><label class="operation" title="操作"><ul class="operlist">';
            $.each(opts.option, function(k, g) {
              var vb = disp(g.visible);
              if (g.url != undefined && g.url != "") {
                var item = g.url.split("&"),
                  uu = new Array(),
                  gname = new Array(),
                  gurl = "";
                $.each(item, function(a, z) {
                  uu[a] = z.match(/\{\{(.+?)\}\}/g);
                  if (uu[a] != "" && uu[a] != null) {
                    uu[a] = uu[a].toString()
                    gname[a] = uu[a].substring(2, uu[a].length - 2);
                    gurl += z.replace(uu[a], f[gname[a]]);
                  } else {
                    gurl += z;
                  }
                  if (a < item.length - 1) {
                    gurl += "&";
                  }
                });
                h += '<li class="' + g.icon + '" goto="' + gurl + '" title=' + g.tip + ' style="display:' + vb + '">';
              } else if (g.fun != undefined && g.fun != "") {
                var item = g.fun.split(","),
                  uu = new Array(),
                  gname = new Array(),
                  gfun = "";
                $.each(item, function(a, z) {
                  uu[a] = z.match(/\{\{(.+?)\}\}/g);
                  if (uu[a] != null) {
                    uu[a] = uu[a].toString()
                    if (uu[a] != "") {
                      gname[a] = uu[a].substring(2, uu[a].length - 2);
                      gfun += z.replace(uu[a], f[gname[a]]);
                    }
                  } else {
                    gfun += z;
                  }
                  if (a < item.length - 1) {
                    gfun += ",";
                  }
                });
                h += '<li class="' + g.icon + '" onclick="' + gfun + '" title=' + g.tip + ' style="display:' + vb + '">';
              } else {
                h += '<li class="' + g.icon + '" title=' + g.tip + ' style="display:' + vb + '">';
              }
              if (g.list != undefined && g.url != "") {
                h += '<span class="menulist">';
                $.each(g.list, function(l, ht) {
                  if (ht.display == "--") {
                    h += '<span>' + ht.display + '</span>';
                  } else if (ht.url != undefined && ht.url != "") {
                    var htitem = ht.url.split("&"),
                      htuu = new Array(),
                      htname = new Array(),
                      hturl = "";
                    $.each(htitem, function(a, z) {
                      htuu[a] = z.match(/\{\{(.+?)\}\}/g);
                      if (htuu[a] != "" && htuu[a] != null) {
                        htuu[a] = htuu[a].toString()
                        htname[a] = htuu[a].substring(2, htuu[a].length - 2);
                        hturl += z.replace(htuu[a], f[htname[a]]);
                      } else {
                        hturl += z;
                      }
                      if (a < htitem.length - 1) {
                        hturl += "&";
                      }
                    });
                    h += '<span goto="' + hturl + '">' + ht.display + '</span>';
                  } else if (ht.fun != undefined && ht.fun != "") {
                    var item = ht.fun.split(","),
                      htuu = new Array(),
                      htname = new Array(),
                      htfun = "";
                    $.each(item, function(a, z) {
                      htuu[a] = z.match(/\{\{(.+?)\}\}/g);
                      if (htuu[a] != null) {
                        htuu[a] = htuu[a].toString()
                        htname[a] = htuu[a].substring(2, htuu[a].length - 2);
                        htfun += z.replace(htuu[a], f[htname[a]]);

                      } else {
                        htfun += z;
                      }
                      if (a < item.length - 1) {
                        htfun += ",";
                      }
                    });
                    h += '<span onclick="' + htfun + '">' + ht.display + '</span>';
                  }
                });
                h += '</span>';
              }
              h += '</li>';
            })
            h += '</ul></label></td>';
          }
          h += '</tr>';
        });
        $(".datafooter").show();
        if (d.list.length == 0) {
          h += '<tr gutter = "20"><td class="nodata" colspan="' + cols + '" align="center">没有查询到相关数据</td></tr>';
          $(".datafooter").hide();
        }
        h += '</table>';
        _this.find(".lbox").html(h);
        $(".right_con").animate({
          scrollTop: 0
        }, 100);
        _this.find(".lbox").find("td[dofun]").each(function() {
          var row = $(this).attr("row");
          eval($(this).attr("dofun") + "('" + $(this).text() + "',this,fullData[row])");
        });
        if (typeof(opts.callback) == "function") {
          opts.callback(fullData, _this);
        }
        //分页处理
        p = _this.find(".pager");
        p.html('<div class="fl">共<span>' + d.total + '</span>条记录&nbsp;&nbsp;每页显示<span class="pageSize"><span class="ps">' + sz + '</span>条<span class="size"><em><i>5</i>条</em><em><i>10</i>条</em><em><i>20</i>条</em><em><i>50</i>条</em><em><i>100</i>条</em><em><i>200</i>条</em></span></span>&nbsp;&nbsp;第<span class="page">' + d.pageNum + '</span>/<span class="pageCount">' + d.pages + '</span>页</div><div class="fr"><button class="first" disabled></button><button class="prev" disabled></button><button class="next"></button><button class="last"></button></div>');
        p.find(".chk.all>input").removeAttr("checked");
        p.find("button").unbind("click");
        p.find("button").removeAttr("disabled");
        p.find(".next").click(function() {
          doSearch(d.pageNum + 1);
        });
        p.find(".prev").click(function() {
          doSearch(d.pageNum - 1);
        });
        p.find(".first").click(function() {
          doSearch(1);
        });
        p.find(".last").click(function() {
          doSearch(d.pages);
        });
        if (d.pageNum >= d.pages) {
          p.find(".next,.last").attr("disabled", true);
        }
        if (d.pageNum <= 1) {
          p.find(".first,.prev").attr("disabled", true);
        }
        p.find(".pageSize").unbind("click");
        p.unbind("click");
        p.on("click", "em", function() {
          var stor = _this.attr("storage");
          var ssz = $(this).children("i").text();
          window.localStorage.setItem(stor + 'pageSize', ssz);
          p.find(".pageSize").children(".ps").text(ssz);
          doSearch(1);
        });
        //间距处理
        _this.find("[gutter]").each(function() {
          var m = $(this).attr("gutter") || 0;
          var w = $(this).width();
          $(this).children().css({
            "padding-left": m / 2,
            "padding-right": m / 2
          });
          $(this).css({
            "margin-left": -m / 2,
            "margin-right": -m / 2
          })
        });
        $(".menulist").each(function() {
          var obj = $(this);
          var r = window.location.search.substr(1);
          var u;
          obj.find("a").each(function() {
            u = $(this).attr("href");
            if (u.match("[\?]")) {
              $(this).attr("href", u + "&" + r);
            } else {
              $(this).attr("href", u + "?" + r);
            }
          });
          $(this).find("span").each(function() {
            if ($(this).text() == "--") {
              $(this).height(1).text("").css("border-bottom", "1px solid #dcdcdc");
            }
          });
        });
        _this.getOper(); //获得操作按钮
      }
    });
  }
  $.fn.getList.setBackData = function(initData) {
    data = $.extend({}, data, initData);
  }
  $.fn.getList.setData = function(initData) {
    data = $.extend({}, data, initData);
    doSearch();
  }
  $.fn.getList.refresh = function() {
    doSearch(pg.num);
  }
  $(this).find(".pageSize .ps").text(sz);
  var sc = $($(this).attr("data-sc"));
  var _this = $(this);
  if (opts.ignoreWidth) {
    _this.find(".lbox").css({
      "white-space": "nowrap",
      "overflow-x": "auto"
    })
  }
  var w = new Array();
  doSearch();
  sc.find("[main]").unbind("click");
  sc.find("[main]").click(function(s) {
    sc.find("[search-obj]").each(function() {
      if ($(this).attr("ly-type") == "radio") {
        var w = $(this).attr("search-obj");
        search[w] = $.trim($(this).find("[type=radio]:checked").val());
      } else if ($(this).attr("ly-type") == "checkbox") {
        var cv = "";
        var _obj = $(this);
        _obj.find("input:checked").each(function(i) {
          if (i < _obj.find("input:checked").length - 1) {
            cv += $.trim($(this).val()) + ",";
          } else {
            cv += $.trim($(this).val());
          }
        });
        search[_obj.attr("search-obj")] = cv || "";
      } else if ($(this).attr("ly-type") == "select") {
        var cv = "";
        // var _obj = $(this).find("select");
        var _obj = $(this);
        cv = $.trim(_obj.val());
        search[$(this).attr("search-obj")] = cv || "";
      } else {
        var w = $(this).attr("search-obj");
        search[w] = $.trim($(this).val());
      }
    });
    sc.find("[screen-obj]").each(function() {
      screen[$(this).attr("screen-obj")] = $.trim($(this).find("input:checked").val()) || "";
    });
    data = $.extend(data, screen, search);
    doSearch(1);
  });
  sc.find("[screen-obj]").unbind("change");
  sc.find("[screen-obj]").on("change", "input", function() {
    if ($(this).is(":checkbox")) {
      if ($(this).is(":checked")) {
        screen[$(this).parents("[screen-obj]").attr("screen-obj")] = $(this).val();
      } else {
        screen[$(this).parents("[screen-obj]").attr("screen-obj")] = "";
      }
    } else {
      screen[$(this).parents("[screen-obj]").attr("screen-obj")] = $(this).val();
    }
    data = $.extend(data, screen, search);
    doSearch(1);
  });
  lyComplete();
};

/**
 *	数据列表Two
 */

$.fn.getListTwo = function(options) {
  var search = {},
    screen = {},
    order = {},
    config = {},
    sz,
    pg = {};
  var opts = $.extend({}, options);
  var data = $.extend({}, opts.initData)
  if (opts == {}) {
    $(".tipbox").showTips({
      text: "表格配置有误，请检查表格配置",
      type: "error"
    });
    return false;
  }
  var doSearch = function(p) {
    $(".chk.all").find("input").prop("checked", false);
    var h = "";
    sz = window.localStorage.getItem(_this.attr("storage") + 'pageSize') || "10"; //获得表格分页数据
    var stgPage = window.sessionStorage.getItem(_this.attr("storage") + "pageNum");
    if (p) {
      window.sessionStorage.setItem(_this.attr("storage") + "pageNum", p);
    }
    _this.find(".pageSize").children(".ps").text(sz);
    data["page"] = p || stgPage || data.num || 1;
    data["pageSize"] = sz || opts.initData.size || 10;
    url = opts.url;
    var fullData = {};
    request({
      url: url,
      data: data,
      contentType: opts.contentType || '',
      ajaxform: opts.ajaxform || '',
      type: opts.type,
      callback: function(r) {
        var d = r.data;
        pg = d;
        if (r.code !== 200) {
          _this.find(".lbox").showTips({
            text: r.code + ":" + (r.msg || r.desc),
            type: "error"
          });
          ly.alert(r.desc || r.msg, function() {
            if (r.desc == "登录过期，请重新登录" || r.msg == "登录过期，请重新登录") {
              window.location.href = site.interUrl + "login.html" 
            } else if (r.desc == "错误的token" || r.msg == "错误的token") {
              window.location.reload();
            }
          })
          return;
        }
        if (d.content == undefined) {
          $(".tipbox").showTips({
            text: "数据结构有误，请检查数据list是否存在",
            type: "error"
          });
          return;
        }
        fullData = d.content;
        h += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr gutter = "20">';
        var cols = 0;
        if (opts.checkname != undefined && opts.checkname != "") { //选择列
          h += '<th class="w70">&nbsp;</th>';
          cols += 1;
        }
        $.each(opts.col, function(i, e) { //表头
          if (e.width != undefined && e.width != "") {
            st = "col-" + e.width;
          } else {
            st = "";
          }
          h += '<th class = "' + st + '">' + e.display + '</th>';
          cols += 1;
        });
        if (opts.option != undefined && opts.option != "") { //操作列
          h += '<th class="w70">操作</th>';
          cols += 1;
        }
        h += '</tr>';
        $.each(d.content, function(j, f) {
          h += '<tr gutter = "20">';
          if (opts.checkname != undefined && opts.checkname != "") {
            h += '<td><div class="chk"><input type="checkbox" name="' + opts.checkname + '" value = "' + f.id + '"';
            if (opts.checkattr != undefined && opts.checkattr != "") {
              $.each(opts.checkattr, function(k, g) {
                if (g.value != undefined && g.value != "") {
                  var item = g.value.split(","),
                    uu = new Array(),
                    gname = new Array(),
                    gattr = "";
                  $.each(item, function(a, z) {
                    uu[a] = z.match(/\{\{(.+?)\}\}/g);
                    if (uu[a] != "" && uu[a] != null) {
                      uu[a] = uu[a].toString()
                      gname[a] = uu[a].substring(2, uu[a].length - 2);
                      gattr += z.replace(uu[a], f[gname[a]]);
                    } else {
                      gattr = z;
                    }
                    if (a < item.length - 1) {
                      gattr += ",";
                    }
                  });
                  h += g.attr + '="' + gattr + '"';
                }
              });
            }
            h += '><b></b></div></td>';
          }
          $.each(opts.col, function(i, e) {
            var ff = getter(f, e.field) != undefined ? getter(f, e.field) : "";
            if (e.show != undefined && e.show !== "") {
              $.each(e.show, function(k, g) {
                if (ff == g.value) {
                  h += '<td>' + g.html + '</td>';
                }
              });
            } else if (e.fun != undefined && e.fun !== "") {
              h += '<td dofun="' + e.fun + '" row="' + j + '">' + ff + '</td>';
            } else {
              var bf = e.prefix || "";
              var af = e.suffix || "";
              h += '<td class="text-overflow">' + bf + ff + af + '</td>';
            }
          });
          if (opts.option != undefined && opts.option != "") { //操作列
            h += '<td><label class="operation" title="操作"><ul class="operlist">';
            $.each(opts.option, function(k, g) {
              var vb = disp(g.visible);
              if (g.url != undefined && g.url != "") {
                var item = g.url.split("&"),
                  uu = new Array(),
                  gname = new Array(),
                  gurl = "";
                $.each(item, function(a, z) {
                  uu[a] = z.match(/\{\{(.+?)\}\}/g);
                  if (uu[a] != "" && uu[a] != null) {
                    uu[a] = uu[a].toString()
                    gname[a] = uu[a].substring(2, uu[a].length - 2);
                    gurl += z.replace(uu[a], f[gname[a]]);
                  } else {
                    gurl += z;
                  }
                  if (a < item.length - 1) {
                    gurl += "&";
                  }
                });
                h += '<li class="' + g.icon + '" goto="' + gurl + '" title=' + g.tip + ' style="display:' + vb + '">';
              } else if (g.fun != undefined && g.fun != "") {
                var item = g.fun.split(","),
                  uu = new Array(),
                  gname = new Array(),
                  gfun = "";
                $.each(item, function(a, z) {
                  uu[a] = z.match(/\{\{(.+?)\}\}/g);
                  if (uu[a] != null) {
                    uu[a] = uu[a].toString()
                    if (uu[a] != "") {
                      gname[a] = uu[a].substring(2, uu[a].length - 2);
                      gfun += z.replace(uu[a], f[gname[a]]);
                    }
                  } else {
                    gfun += z;
                  }
                  if (a < item.length - 1) {
                    gfun += ",";
                  }
                });
                h += '<li class="' + g.icon + '" onclick="' + gfun + '" title=' + g.tip + ' style="display:' + vb + '">';
              } else {
                h += '<li class="' + g.icon + '" title=' + g.tip + ' style="display:' + vb + '">';
              }
              if (g.list != undefined && g.url != "") {
                h += '<span class="menulist">';
                $.each(g.list, function(l, ht) {
                  if (ht.display == "--") {
                    h += '<span>' + ht.display + '</span>';
                  } else if (ht.url != undefined && ht.url != "") {
                    var htitem = ht.url.split("&"),
                      htuu = new Array(),
                      htname = new Array(),
                      hturl = "";
                    $.each(htitem, function(a, z) {
                      htuu[a] = z.match(/\{\{(.+?)\}\}/g);
                      if (htuu[a] != "" && htuu[a] != null) {
                        htuu[a] = htuu[a].toString()
                        htname[a] = htuu[a].substring(2, htuu[a].length - 2);
                        hturl += z.replace(htuu[a], f[htname[a]]);
                      } else {
                        hturl += z;
                      }
                      if (a < htitem.length - 1) {
                        hturl += "&";
                      }
                    });
                    h += '<span goto="' + hturl + '">' + ht.display + '</span>';
                  } else if (ht.fun != undefined && ht.fun != "") {
                    var item = ht.fun.split(","),
                      htuu = new Array(),
                      htname = new Array(),
                      htfun = "";
                    $.each(item, function(a, z) {
                      htuu[a] = z.match(/\{\{(.+?)\}\}/g);
                      if (htuu[a] != null) {
                        htuu[a] = htuu[a].toString()
                        htname[a] = htuu[a].substring(2, htuu[a].length - 2);
                        htfun += z.replace(htuu[a], f[htname[a]]);

                      } else {
                        htfun += z;
                      }
                      if (a < item.length - 1) {
                        htfun += ",";
                      }
                    });
                    h += '<span onclick="' + htfun + '">' + ht.display + '</span>';
                  }
                });
                h += '</span>';
              }
              h += '</li>';
            })
            h += '</ul></label></td>';
          }
          h += '</tr>';
        });
        $(".datafooter").show();
        if (d.content.length == 0) {
          h += '<tr gutter = "20"><td class="nodata" colspan="' + cols + '" align="center">没有查询到相关数据</td></tr>';
          $(".datafooter").hide();
        }
        h += '</table>';
        _this.find(".lbox").html(h);
        $(".right_con").animate({
          scrollTop: 0
        }, 100);
        _this.find(".lbox").find("td[dofun]").each(function() {
          var row = $(this).attr("row");
          eval($(this).attr("dofun") + "('" + $(this).text() + "',this,fullData[row])");
        });
        if (typeof(opts.callback) == "function") {
          opts.callback(fullData, _this);
        }
        //分页处理
        var currentPage = d.pageable.pageNumber + 1;
        var lastPageNum;
        lastPageNum = Math.ceil(d.totalElements / d.pageable.pageSize)
        p = _this.find(".pager");
        p.html('<div class="fl">共<span>' + d.totalElements + '</span>条记录&nbsp;&nbsp;每页显示<span class="pageSize"><span class="ps">' + sz + '</span>条<span class="size"><em><i>5</i>条</em><em><i>10</i>条</em><em><i>20</i>条</em><em><i>50</i>条</em><em><i>100</i>条</em><em><i>200</i>条</em></span></span>&nbsp;&nbsp;第<span class="page">' + currentPage + '</span>/<span class="pageCount">' + lastPageNum + '</span>页</div><div class="fr"><button class="first" disabled></button><button class="prev" disabled></button><button class="next"></button><button class="last"></button></div>');
        p.find(".chk.all>input").removeAttr("checked");
        p.find("button").unbind("click");
        p.find("button").removeAttr("disabled");
        p.find(".next").click(function() {
          doSearch(currentPage + 1);
        });
        p.find(".prev").click(function() {
          doSearch(currentPage - 1);
        });
        p.find(".first").click(function() {
          doSearch(1);
        });
        p.find(".last").click(function() {
          doSearch(lastPageNum);
        });
        if (currentPage >= lastPageNum) {
          p.find(".next,.last").attr("disabled", true);
        }
        if (currentPage <= 1) {
          p.find(".first,.prev").attr("disabled", true);
        }
        p.find(".pageSize").unbind("click");
        p.unbind("click");
        p.on("click", "em", function() {
          var stor = _this.attr("storage");
          var ssz = $(this).children("i").text();
          window.localStorage.setItem(stor + 'pageSize', ssz);
          p.find(".pageSize").children(".ps").text(ssz);
          doSearch(1);
        });
        //间距处理
        _this.find("[gutter]").each(function() {
          var m = $(this).attr("gutter") || 0;
          var w = $(this).width();
          $(this).children().css({
            "padding-left": m / 2,
            "padding-right": m / 2
          });
          $(this).css({
            "margin-left": -m / 2,
            "margin-right": -m / 2
          })
        });
        $(".menulist").each(function() {
          var obj = $(this);
          var r = window.location.search.substr(1);
          var u;
          obj.find("a").each(function() {
            u = $(this).attr("href");
            if (u.match("[\?]")) {
              $(this).attr("href", u + "&" + r);
            } else {
              $(this).attr("href", u + "?" + r);
            }
          });
          $(this).find("span").each(function() {
            if ($(this).text() == "--") {
              $(this).height(1).text("").css("border-bottom", "1px solid #dcdcdc");
            }
          });
        });
        _this.getOper(); //获得操作按钮
      }
    });
  }
  $.fn.getListTwo.setBackData = function(initData) {
    data = $.extend({}, data, initData);
  }
  $.fn.getListTwo.setData = function(initData) {
    data = $.extend({}, data, initData);
    doSearch();
  }
  $.fn.getListTwo.refresh = function() {
    doSearch(pg.pageable.pageNumber);
  }
  $(this).find(".pageSize .ps").text(sz);
  var sc = $($(this).attr("data-sc"));
  var _this = $(this);
  if (opts.ignoreWidth) {
    _this.find(".lbox").css({
      "white-space": "nowrap",
      "overflow-x": "auto"
    })
  }
  var w = new Array();
  doSearch();
  sc.find("[main]").unbind("click");
  sc.find("[main]").click(function(s) {
    sc.find("[search-obj]").each(function() {
      if ($(this).attr("ly-type") == "radio") {
        var w = $(this).attr("search-obj");
        search[w] = $.trim($(this).find("[type=radio]:checked").val());
      } else if ($(this).attr("ly-type") == "checkbox") {
        var cv = "";
        var _obj = $(this);
        _obj.find("input:checked").each(function(i) {
          if (i < _obj.find("input:checked").length - 1) {
            cv += $.trim($(this).val()) + ",";
          } else {
            cv += $.trim($(this).val());
          }
        });
        search[_obj.attr("search-obj")] = cv || "";
      } else if ($(this).attr("ly-type") == "select") {
        var cv = "";
        var _obj = $(this);
        cv = $.trim(_obj.val());
        search[$(this).attr("search-obj")] = cv || "";
      } else {
        var w = $(this).attr("search-obj");
        search[w] = $.trim($(this).val());
      }
    });
    sc.find("[screen-obj]").each(function() {
      screen[$(this).attr("screen-obj")] = $.trim($(this).find("input:checked").val()) || "";
    });
    data = $.extend(data, screen, search);
    doSearch(1);
  });
  sc.find("[screen-obj]").unbind("change");
  sc.find("[screen-obj]").on("change", "input", function() {
    if ($(this).is(":checkbox")) {
      if ($(this).is(":checked")) {
        screen[$(this).parents("[screen-obj]").attr("screen-obj")] = $(this).val();
      } else {
        screen[$(this).parents("[screen-obj]").attr("screen-obj")] = "";
      }
    } else {
      screen[$(this).parents("[screen-obj]").attr("screen-obj")] = $(this).val();
    }
    data = $.extend(data, screen, search);
    doSearch(1);
  });
  lyComplete();
};

/**
 *	数据列表Three
 */

$.fn.getListThree = function(options) {
  var search = {},
    screen = {},
    order = {},
    config = {},
    sz,
    pg = {};
  var opts = $.extend({}, options);
  var data = $.extend({}, opts.initData)
  if (opts == {}) {
    $(".tipbox").showTips({
      text: "表格配置有误，请检查表格配置",
      type: "error"
    });
    return false;
  }
  var doSearch = function(p) {
    $(".chk.all").find("input").prop("checked", false);
    var h = "";
    sz = window.localStorage.getItem(_this.attr("storage") + 'pageSize') || "10"; //获得表格分页数据
    var stgPage = window.sessionStorage.getItem(_this.attr("storage") + "pageNum");
    if (p) {
      window.sessionStorage.setItem(_this.attr("storage") + "pageNum", p);
    }
    _this.find(".pageSize").children(".ps").text(sz);
    data["page"] = p || stgPage || data.num || 1;
    data["pageSize"] = sz || opts.initData.size || 10;
    url = opts.url;
    var fullData = {};
    request({
      url: url,
      data: data,
      contentType: opts.contentType || '',
      ajaxform: opts.ajaxform || '',
      type: opts.type,
      callback: function(r) {
        var d = r;
        pg = d;
        if (r.code !== 'success') {
          // _this.find(".lbox").showTips({
          //   text: r.code + ":" + r.msg,
          //   type: "error"
          // });
          // ly.alert(r.msg, function() {
          //   // window.history.back();
          // })
          return;
        }
        if (d.result == undefined) {
          $(".tipbox").showTips({
            text: "数据结构有误，请检查数据list是否存在",
            type: "error"
          });
          return;
        }
        fullData = d.result;
        h += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr gutter = "20">';
        var cols = 0;
        if (opts.checkname != undefined && opts.checkname != "") { //选择列
          h += '<th class="w70">&nbsp;</th>';
          cols += 1;
        }
        $.each(opts.col, function(i, e) { //表头
          if (e.width != undefined && e.width != "") {
            st = "col-" + e.width;
          } else {
            st = "";
          }
          h += '<th class = "' + st + '">' + e.display + '</th>';
          cols += 1;
        });
        if (opts.option != undefined && opts.option != "") { //操作列
          h += '<th class="w70">操作</th>';
          cols += 1;
        }
        h += '</tr>';
        $.each(d.data, function(j, f) {
          h += '<tr gutter = "20">';
          if (opts.checkname != undefined && opts.checkname != "") {
            h += '<td><div class="chk"><input type="checkbox" name="' + opts.checkname + '" value = "' + f.id + '"';
            if (opts.checkattr != undefined && opts.checkattr != "") {
              $.each(opts.checkattr, function(k, g) {
                if (g.value != undefined && g.value != "") {
                  var item = g.value.split(","),
                    uu = new Array(),
                    gname = new Array(),
                    gattr = "";
                  $.each(item, function(a, z) {
                    uu[a] = z.match(/\{\{(.+?)\}\}/g);
                    if (uu[a] != "" && uu[a] != null) {
                      uu[a] = uu[a].toString()
                      gname[a] = uu[a].substring(2, uu[a].length - 2);
                      gattr += z.replace(uu[a], f[gname[a]]);
                    } else {
                      gattr = z;
                    }
                    if (a < item.length - 1) {
                      gattr += ",";
                    }
                  });
                  h += g.attr + '="' + gattr + '"';
                }
              });
            }
            h += '><b></b></div></td>';
          }
          $.each(opts.col, function(i, e) {
            var ff = getter(f, e.field) != undefined ? getter(f, e.field) : "";
            if (e.show != undefined && e.show !== "") {
              $.each(e.show, function(k, g) {
                if (ff == g.value) {
                  h += '<td>' + g.html + '</td>';
                }
              });
            } else if (e.fun != undefined && e.fun !== "") {
              h += '<td dofun="' + e.fun + '" row="' + j + '">' + ff + '</td>';
            } else {
              var bf = e.prefix || "";
              var af = e.suffix || "";
              h += '<td class="text-overflow">' + bf + ff + af + '</td>';
            }
          });
          if (opts.option != undefined && opts.option != "") { //操作列
            h += '<td><label class="operation" title="操作"><ul class="operlist">';
            $.each(opts.option, function(k, g) {
              var vb = disp(g.visible);
              if (g.url != undefined && g.url != "") {
                var item = g.url.split("&"),
                  uu = new Array(),
                  gname = new Array(),
                  gurl = "";
                $.each(item, function(a, z) {
                  uu[a] = z.match(/\{\{(.+?)\}\}/g);
                  if (uu[a] != "" && uu[a] != null) {
                    uu[a] = uu[a].toString()
                    gname[a] = uu[a].substring(2, uu[a].length - 2);
                    gurl += z.replace(uu[a], f[gname[a]]);
                  } else {
                    gurl += z;
                  }
                  if (a < item.length - 1) {
                    gurl += "&";
                  }
                });
                h += '<li class="' + g.icon + '" goto="' + gurl + '" title=' + g.tip + ' style="display:' + vb + '">';
              } else if (g.fun != undefined && g.fun != "") {
                var item = g.fun.split(","),
                  uu = new Array(),
                  gname = new Array(),
                  gfun = "";
                $.each(item, function(a, z) {
                  uu[a] = z.match(/\{\{(.+?)\}\}/g);
                  if (uu[a] != null) {
                    uu[a] = uu[a].toString()
                    if (uu[a] != "") {
                      gname[a] = uu[a].substring(2, uu[a].length - 2);
                      gfun += z.replace(uu[a], f[gname[a]]);
                    }
                  } else {
                    gfun += z;
                  }
                  if (a < item.length - 1) {
                    gfun += ",";
                  }
                });
                h += '<li class="' + g.icon + '" onclick="' + gfun + '" title=' + g.tip + ' style="display:' + vb + '">';
              } else {
                h += '<li class="' + g.icon + '" title=' + g.tip + ' style="display:' + vb + '">';
              }
              if (g.list != undefined && g.url != "") {
                h += '<span class="menulist">';
                $.each(g.list, function(l, ht) {
                  if (ht.display == "--") {
                    h += '<span>' + ht.display + '</span>';
                  } else if (ht.url != undefined && ht.url != "") {
                    var htitem = ht.url.split("&"),
                      htuu = new Array(),
                      htname = new Array(),
                      hturl = "";
                    $.each(htitem, function(a, z) {
                      htuu[a] = z.match(/\{\{(.+?)\}\}/g);
                      if (htuu[a] != "" && htuu[a] != null) {
                        htuu[a] = htuu[a].toString()
                        htname[a] = htuu[a].substring(2, htuu[a].length - 2);
                        hturl += z.replace(htuu[a], f[htname[a]]);
                      } else {
                        hturl += z;
                      }
                      if (a < htitem.length - 1) {
                        hturl += "&";
                      }
                    });
                    h += '<span goto="' + hturl + '">' + ht.display + '</span>';
                  } else if (ht.fun != undefined && ht.fun != "") {
                    var item = ht.fun.split(","),
                      htuu = new Array(),
                      htname = new Array(),
                      htfun = "";
                    $.each(item, function(a, z) {
                      htuu[a] = z.match(/\{\{(.+?)\}\}/g);
                      if (htuu[a] != null) {
                        htuu[a] = htuu[a].toString()
                        htname[a] = htuu[a].substring(2, htuu[a].length - 2);
                        htfun += z.replace(htuu[a], f[htname[a]]);

                      } else {
                        htfun += z;
                      }
                      if (a < item.length - 1) {
                        htfun += ",";
                      }
                    });
                    h += '<span onclick="' + htfun + '">' + ht.display + '</span>';
                  }
                });
                h += '</span>';
              }
              h += '</li>';
            })
            h += '</ul></label></td>';
          }
          h += '</tr>';
        });
        $(".datafooter").show();
        if (d.result.length == 0) {
          h += '<tr gutter = "20"><td class="nodata" colspan="' + cols + '" align="center">没有查询到相关数据</td></tr>';
          $(".datafooter").hide();
        }
        h += '</table>';
        _this.find(".lbox").html(h);
        $(".right_con").animate({
          scrollTop: 0
        }, 100);
        _this.find(".lbox").find("td[dofun]").each(function() {
          var row = $(this).attr("row");
          eval($(this).attr("dofun") + "('" + $(this).text() + "',this,fullData[row])");
        });
        if (typeof(opts.callback) == "function") {
          opts.callback(fullData, _this);
        }
        //分页处理
        var currentPage = d.pageable.pageNumber + 1;
        var lastPageNum;
        lastPageNum = Math.ceil(d.totalElements / d.pageable.pageSize)
        p = _this.find(".pager");
        p.html('<div class="fl">共<span>' + d.totalElements + '</span>条记录&nbsp;&nbsp;每页显示<span class="pageSize"><span class="ps">' + sz + '</span>条<span class="size"><em><i>5</i>条</em><em><i>10</i>条</em><em><i>20</i>条</em><em><i>50</i>条</em><em><i>100</i>条</em><em><i>200</i>条</em></span></span>&nbsp;&nbsp;第<span class="page">' + currentPage + '</span>/<span class="pageCount">' + lastPageNum + '</span>页</div><div class="fr"><button class="first" disabled></button><button class="prev" disabled></button><button class="next"></button><button class="last"></button></div>');
        p.find(".chk.all>input").removeAttr("checked");
        p.find("button").unbind("click");
        p.find("button").removeAttr("disabled");
        p.find(".next").click(function() {
          doSearch(currentPage + 1);
        });
        p.find(".prev").click(function() {
          doSearch(currentPage - 1);
        });
        p.find(".first").click(function() {
          doSearch(1);
        });
        p.find(".last").click(function() {
          doSearch(lastPageNum);
        });
        if (currentPage >= lastPageNum) {
          p.find(".next,.last").attr("disabled", true);
        }
        if (currentPage <= 1) {
          p.find(".first,.prev").attr("disabled", true);
        }
        p.find(".pageSize").unbind("click");
        p.unbind("click");
        p.on("click", "em", function() {
          var stor = _this.attr("storage");
          var ssz = $(this).children("i").text();
          window.localStorage.setItem(stor + 'pageSize', ssz);
          p.find(".pageSize").children(".ps").text(ssz);
          doSearch(1);
        });
        //间距处理
        _this.find("[gutter]").each(function() {
          var m = $(this).attr("gutter") || 0;
          var w = $(this).width();
          $(this).children().css({
            "padding-left": m / 2,
            "padding-right": m / 2
          });
          $(this).css({
            "margin-left": -m / 2,
            "margin-right": -m / 2
          })
        });
        $(".menulist").each(function() {
          var obj = $(this);
          var r = window.location.search.substr(1);
          var u;
          obj.find("a").each(function() {
            u = $(this).attr("href");
            if (u.match("[\?]")) {
              $(this).attr("href", u + "&" + r);
            } else {
              $(this).attr("href", u + "?" + r);
            }
          });
          $(this).find("span").each(function() {
            if ($(this).text() == "--") {
              $(this).height(1).text("").css("border-bottom", "1px solid #dcdcdc");
            }
          });
        });
        _this.getOper(); //获得操作按钮
      }
    });
  }
  $.fn.getListThree.setBackData = function(initData) {
    data = $.extend({}, data, initData);
  }
  $.fn.getListThree.setData = function(initData) {
    data = $.extend({}, data, initData);
    doSearch();
  }
  $.fn.getListThree.refresh = function() {
    doSearch(pg.pageable.pageNumber);
  }
  $(this).find(".pageSize .ps").text(sz);
  var sc = $($(this).attr("data-sc"));
  var _this = $(this);
  if (opts.ignoreWidth) {
    _this.find(".lbox").css({
      "white-space": "nowrap",
      "overflow-x": "auto"
    })
  }
  var w = new Array();
  doSearch();
  sc.find("[main]").unbind("click");
  sc.find("[main]").click(function(s) {
    sc.find("[search-obj]").each(function() {
      if ($(this).attr("ly-type") == "radio") {
        var w = $(this).attr("search-obj");
        search[w] = $.trim($(this).find("[type=radio]:checked").val());
      } else if ($(this).attr("ly-type") == "checkbox") {
        var cv = "";
        var _obj = $(this);
        _obj.find("input:checked").each(function(i) {
          if (i < _obj.find("input:checked").length - 1) {
            cv += $.trim($(this).val()) + ",";
          } else {
            cv += $.trim($(this).val());
          }
        });
        search[_obj.attr("search-obj")] = cv || "";
      } else if ($(this).attr("ly-type") == "select") {
        var cv = "";
        var _obj = $(this);
        cv = $.trim(_obj.val());
        search[$(this).attr("search-obj")] = cv || "";
      } else {
        var w = $(this).attr("search-obj");
        search[w] = $.trim($(this).val());
      }
    });
    sc.find("[screen-obj]").each(function() {
      screen[$(this).attr("screen-obj")] = $.trim($(this).find("input:checked").val()) || "";
    });
    data = $.extend(data, screen, search);
    doSearch(1);
  });
  sc.find("[screen-obj]").unbind("change");
  sc.find("[screen-obj]").on("change", "input", function() {
    if ($(this).is(":checkbox")) {
      if ($(this).is(":checked")) {
        screen[$(this).parents("[screen-obj]").attr("screen-obj")] = $(this).val();
      } else {
        screen[$(this).parents("[screen-obj]").attr("screen-obj")] = "";
      }
    } else {
      screen[$(this).parents("[screen-obj]").attr("screen-obj")] = $(this).val();
    }
    data = $.extend(data, screen, search);
    doSearch(1);
  });
  lyComplete();
};

/*菜单列表*/
$.fn.getChannelList = function (options) {
	// console.log(options);
	
	var search = {},
		screen = {},
		order = {},
		config = {},
		sz,
		pg = {};
	var opts = $.extend({}, options);
	var data = $.extend({}, opts.initData);
	if (opts == {}) {
		$(".tipbox").showTips({
			text: "表格配置有误，请检查表格配置",
			type: "error"
		});
		return false;
	}
	var $current = '';
	var _this = $(this);
	var fullData = {};
	initChannel(1);

	function initChannel(p) {
		
		var h = '';
		if(!$current) {
			sz = window.localStorage.getItem(_this.attr("storage") + 'pageSize') || "10"; //获得表格分页数据
			_this.find(".pageSize").children(".ps").text(sz);
			data["num"] = p || data.num || 1;
			data["size"] = sz || opts.initData.size || 10;
		}
		$("body").showloading({
			parent: true
		});

		url = opts.url;
		var param = data;
		if($current) {
			param.id = $current.attr('cid');
		}
		param.size = options.initData.size == '' ? '' : param.size;
		requestPost(url, param, function (r) {
			// console.log(r);
			if(!$current){
				pg = r.result;
			}
			// r = prolist[p];
			
			if (r.code != "success") {
				_this.find(".lbox").showTips({
					text: r.code + ":" + r.desc,
					type: "error"
				});
				return;

			}
			if (!r.result) {
				$(".tipbox").showTips({
					text: "数据结构有误，请检查数据list是否存在",
					type: "error"
				});
				return;
			}
			if(!$current) {
				h += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr gutter = "20">';
				var cols = 0;
				$.each(opts.col, function (i, e) { //表头
					if (e.width != undefined && e.width != "") {
						st = "col-" + e.width;
					} else {
						st = "";
					}
					h += '<th class = "' + st + '">' + e.display + '</th>';
					cols += 1;
				});
			
				if (opts.option != undefined && opts.option != "") { //操作列
					h += '<th class="w70">操作</th>';
					cols += 1;
				}
				h += '</tr>';
			}

			var l = '';
			var series = $current ? $current.attr('name').split('_').length : 0;
			var flagClass = '';
			$.each(r.result.list, function (i, items) {
				var cClass = $current ? ($current.attr('name') + '_1') : ('chaannel' + i);
				l += '<tr cid="'+ items.id +'" name="'+ cClass +'" isleaf="'+ ((items.parentNum == 0) ? 'false' : 'true') +'" gotter = "0,0">';
				var dis = (items.parentNum == 0) ? 'hide' : ''; //icon-unflod
				var dis1 = (items.parentNum == 0) ? 'vish' : '';
				$.each(opts.col, function (j, e) {
					var space = (j == 0) ? 'gotter = "'+ (series+1)*40 +',20"' : 'gotter = "20,20"';
					// var i_icon = (j == 0) ? '<i class="iconfont icon-expand '+ ($current ? dis : dis1) +' f18 pr10"></i>' : '';
					var i_icon = (j == 0) ? '<b class="i-expand '+ ($current ? dis : dis1) +'"></b>' : '';
					var ff = getter(items, e.field) != undefined ? getter(items, e.field) : "";
					if (e.show != undefined && e.show !== "") {
						$.each(e.show, function (k, g) {
							if (ff == g.value) {
								l += '<td '+ space +'>'+ i_icon +'<div class="lm-expand pl10">' + g.html + '</div></td>';
							}
						});
					} else if (e.fun != undefined && e.fun !== "") {
						var fdlen = Object.keys(fullData).length;
						fullData[fdlen] = items;
						l += '<td dofun="' + e.fun + '" row="' + fdlen + '" '+ space +'>'+ i_icon +'<div class="lm-expand pl10">' + ff + '</div></td>';
					} else {
						var bf = e.prefix || "";
						var af = e.suffix || "";
						l += '<td '+ space +'>'+ i_icon +'<div class="lm-expand pl10">' + bf + ff + af + '</div></td>';
					}
				});
				if (opts.option != undefined && opts.option != "") { //操作列
					l += '<td><label class="operation" title="操作"><ul class="operlist">';
					$.each(opts.option, function (k, g) {
						var vb = disp(g.visible);
						if (g.url != undefined && g.url != "") {
							var item = g.url.split("&"),
								uu = new Array(),
								gname = new Array(),
								gurl = "";
							$.each(item, function (a, z) {
								uu[a] = z.match(/\{\{(.+?)\}\}/g);
								if (uu[a] != "" && uu[a] != null) {
									uu[a] = uu[a].toString()
									gname[a] = uu[a].substring(2, uu[a].length - 2);
									gurl += z.replace(uu[a], items[gname[a]]);
								} else {
									gurl += z;
								}
								if (a < item.length - 1) {
									gurl += "&";
								}
							});
							l += '<li class="' + g.icon + '" goto="' + gurl + '" title=' + g.tip + ' style="display:' + vb + '">';
						} else if (g.fun != undefined && g.fun != "") {
							var item = g.fun.split(","),
								uu = new Array(),
								gname = new Array(),
								gfun = "";
							$.each(item, function (a, z) {
								uu[a] = z.match(/\{\{(.+?)\}\}/g);
								if (uu[a] != null) {
									uu[a] = uu[a].toString()
									if (uu[a] != "") {
										gname[a] = uu[a].substring(2, uu[a].length - 2);
										gfun += z.replace(uu[a], items[gname[a]]);
									}
								} else {
									gfun += z;
								}
								if (a < item.length - 1) {
									gfun += ",";
								}
							});
							l += '<li class="' + g.icon + '" onclick="' + gfun + '" title=' + g.tip + ' style="display:' + vb + '">';
						} else {
							l += '<li class="' + g.icon + '" title=' + g.tip + ' style="display:' + vb + '">';
						}
						if (g.list != undefined && g.url != "") {
							l += '<span class="menulist">';
							$.each(g.list, function (ls, ht) {
								if (ht.display == "--") {
									l += '<span>' + ht.display + '</span>';
								} else if (ht.url != undefined && ht.url != "") {
									var htitem = ht.url.split("&"),
										htuu = new Array(),
										htname = new Array(),
										hturl = "";
									$.each(htitem, function (a, z) {
										htuu[a] = z.match(/\{\{(.+?)\}\}/g);
										if (htuu[a] != "" && htuu[a] != null) {
											htuu[a] = htuu[a].toString()
											htname[a] = htuu[a].substring(2, htuu[a].length - 2);
											hturl += z.replace(htuu[a], items[htname[a]]);
										} else {
											hturl += z;
										}
										if (a < htitem.length - 1) {
											hturl += "&";
										}
									});
									l += '<span goto="' + hturl + '">' + ht.display + '</span>';
								} else if (ht.fun != undefined && ht.fun != "") {
									var item = ht.fun.split(","),
										htuu = new Array(),
										htname = new Array(),
										htfun = "";
									$.each(item, function (a, z) {
										htuu[a] = z.match(/\{\{(.+?)\}\}/g);
										if (htuu[a] != null) {
											htuu[a] = htuu[a].toString()
											htname[a] = htuu[a].substring(2, htuu[a].length - 2);
											htfun += z.replace(htuu[a], items[htname[a]]);

										} else {
											htfun += z;
										}
										if (a < item.length - 1) {
											htfun += ",";
										}
									});
									l += '<span onclick="' + htfun + '">' + ht.display + '</span>';
								}
							});
							l += '</span>';
						}
						l += '</li>';
					})
					l += '</ul></label></td>';
				}
				l += '</tr>';
			});
			if(options.initData.size == '') {
				$(".datafooter").hide();
			} else {
				$(".datafooter").show();
			}
			if($current) {
				$current.find('b.i-expand').addClass('i-zhankai').removeClass('i-expand');
				$current.after(l);
			} else {
				h += l;
				if(r.result.list.length == 0) {
					h += '<tr gutter = "20"><td class="nodata" colspan="' + cols + '" align="center">暂无相关数据</td></tr>';
					$(".datafooter").hide();
				}
				h += '</table>';
				_this.find(".lbox").html(h);
			}
			
			// $("body").hideloading();
			_this.find(".lbox").find("td[dofun]").each(function () {
				var row = $(this).attr("row");
				eval($(this).attr("dofun") + "('" + $(this).children('.lm-expand').text() + "',$(this).children('.lm-expand')[0],fullData[row])");
			});
			if (typeof (opts.callback) == "function") {
				opts.callback(fullData, _this);
			}

			//间距处理
			_this.find("[gutter]").each(function () {
				var m = $(this).attr("gutter") || 0;
				var w = $(this).width();
				$(this).children().css({
					"padding-left": m / 2,
					"padding-right": m / 2
				});
				$(this).css({
					"margin-left": -m / 2,
					"margin-right": -m / 2
				})
			});
			_this.find("[gotter]").each(function () {
				var m = $(this).attr("gotter") || '0,0';
				var arry = m.split(',');
				$(this).css({
					"padding-left": arry[0] / 2,
					"padding-right": arry[1] / 2
				});
			});
			$(".menulist").each(function () {
				var obj = $(this);
				var r = window.location.search.substr(1);
				var u;
				obj.find("a").each(function () {
						u = $(this).attr("href");
						if (u.match("[\?]")) {
							$(this).attr("href", u + "&" + r);
						} else {
							$(this).attr("href", u + "?" + r);
						}
				});
				$(this).find("span").each(function () {
					if ($(this).text() == "--") {
						$(this).height(1).text("").css("border-bottom", "1px solid #dcdcdc");
					}
				});
			});
			_this.getOper(); //获得操作按钮
			if(!$current) {
				//分页处理
				p = _this.find(".pager");
				p.html('<div class="fl">共<span>' + pg.total + '</span>条记录&nbsp;&nbsp;每页显示<span class="pageSize"><span class="ps">' + sz + '</span>条<span class="size"><em><i>5</i>条</em><em><i>10</i>条</em><em><i>20</i>条</em><em><i>50</i>条</em><em><i>100</i>条</em><em><i>200</i>条</em></span></span>&nbsp;&nbsp;第<span class="page">' + pg.pageNum + '</span>/<span class="pageCount">' + pg.pages + '</span>页</div><div class="fr"><button class="first" disabled></button><button class="prev" disabled></button><button class="next"></button><button class="last"></button></div>');
				p.find(".chk.all>input").removeAttr("checked");
				p.find("button").unbind("click");
				p.find("button").removeAttr("disabled");
				p.find(".next").click(function () {
					fullData = {};
					initChannel(pg.pageNum + 1);
				});
				p.find(".prev").click(function () {
					fullData = {};
					initChannel(pg.pageNum - 1);
				});
				p.find(".first").click(function () {
					fullData = {};
					initChannel(1);
				});
				p.find(".last").click(function () {
					fullData = {};
					initChannel(pg.pages);
				});
				if (pg.pageNum >= pg.pages) {
					p.find(".next,.last").attr("disabled", true);
				}
				if (pg.pageNum <= 1) {
					p.find(".first,.prev").attr("disabled", true);
				}
				p.find(".pageSize").unbind("click");
				p.unbind("click");
				p.on("click", "em", function () {
					var stor = _this.attr("storage");
					var ssz = $(this).children("i").text();
					window.localStorage.setItem(stor + 'pageSize', ssz);
					p.find(".pageSize").children(".ps").text(ssz);
					fullData = {};
					initChannel(1);
				});
			}
			$current = '';
			data.id = '';
				
		},opts.type);
	};
	$.fn.getChannelList.setData = function (initData) {
		data = $.extend({}, data, initData);
		fullData = {};
		initChannel();
	}
	$.fn.getChannelList.refresh = function () {
		fullData = {};
		initChannel(pg.num);
	}
	_this.find(".lbox").on('click','tr[isleaf="true"]', function(e) {
		var o = e.target;
		if($(o).closest('.icon-shanchu1,.icon-xitong,.icon-add').length==0) {
			if($(this).find('b.i-zhankai').length == 1){
				var nameClass = $(this).attr('name');
				$(this).nextAll('[name^="'+ nameClass +'_1"]').remove();
				$(this).find('b.i-zhankai').addClass('i-expand').removeClass('i-zhankai');
				return;
			}
			$current = $(this);
			initChannel(pg.pageNum);
		}
	});
};

//栏目类型组件
$.fn.getColumn = function (options, callback) {
	// console.log(options+"bbbbbbbbbbbbbbbbbbbbbbbbbb");
	// console.log(callback+"aaaaaaaaaaaaaaaaaaaaaaa");
	var thisUrl = site.apiUrl + '/back/menu/selectMenuAllById?id=';
	var obj = $(this),
		h = "",
		defaults = {
			type: "column",
			id: "",
			onlyLeaf: true
		};
	var opts = $.extend({}, defaults, options);
	var required = obj.hasClass('req') ? 'required' : '',
		name = obj.attr('name') ? obj.attr('name') : '',
		tip = obj.attr('data-tip') ? obj.attr('data-tip') : '',
		valid = obj.attr('data-valid') ? obj.attr('data-valid') : '',
		placeholder = obj.attr('placeholder') ? obj.attr('placeholder') : '',
		error = obj.attr('data-error') ? obj.attr('data-error') : '';
	var hascl = obj.hasClass('hasTree'),
		theBox = '';
	var hasbo = obj.next('span.lyshu');
	if (hasbo.length > 0) {
		theBox = obj.next('span.lyshu');
		theBox.html('');
	} else {
		// var thisWid = obj.width() ? obj.width() + 'px' : '100%';
		obj.after('<span class="lyshu" style="display:inline-block;width:100%;z-index:999;"></span>');
		theBox = obj.next('span.lyshu');
	}
	var hasha = obj.hasClass('hide');
	if (hasha) {
		theBox.hide();
	} else {
		theBox.show();
	}
	obj.addClass('hasTree');
	obj.hide();
	var sortId = opts.sortId ? opts.sortId : '';
	requestPost(thisUrl, {id: sortId}, function (d) {
		var e = d.result;
			edata = [],
			newArr = [];
		$.each(e, function(i, j) {
			edata.push(j);
			newArr.push(j);
		});
		
		h = '<div class="bbox" style="position:relative;width:100%;">' +
			'<div class="ipt dm sbox" style="position:relative;display:block;width:100%;max-width:100%;min-width:100%;margin:0;">' +
			'<span class="mm zhankai"></span>' +
			'<nobr>' +
			'<input class="chooseData lmtype ' + required + '" name="' + name + '" data-tip="' + tip + '" data-valid="' + valid + '" placeholder="' + placeholder + '" data-error="' + error + '" type="text" style="width:100%;height:24px;padding:10px 0;cursor:default;border:none;" readonly name="' + opts.asName + '" />' +
			'</nobr>' +
			'</div>' +
			'<div class="treeBox opennn" style="position:absolute;margin-top: 1px;width:100%;height: 300px;border: 1px #ccc solid;border-radius: 2px;z-index: 999;background-color: #f6f9fe;">' +
			'<div style="height:34px;line-height:34px;padding:0 8px;font-size:14px;border-bottom:1px solid #d4dce5;background-color:#fff;">' +
			'<input class="searchLanM" type="text" style="width:91%;height:90%;border:none;" placeholder="请输入栏目名称" /><i class="iconfont icon-search pointer"></i>' +
			'</div>' +
			'<div class="otree" style="width:100%;height:88%;padding-left:18px;">' +
			'<div data-id="" class="folder open root active" data-columnCode="">' + 
            '<span class="node"></span><i></i>根目录</div>' +
            '<div class="sonBox child"></div>'
			'</div>' +
			'</div>' +
			'</div>';
		theBox.append(h);
		var $contentBox = theBox.find('.otree');
    	var $addBox = theBox.find('.sonBox');
    	var flagi = -1;
    	$.each(edata, function(i,item) {
    		if(item.id == sortId) {
    			$addBox.append('' +
                    '<div class="thisCol_' + item.id  + ' parent" data-id="' + item.id + '" data-columnCode="' + item.columnCode + '">' + 
                    '<span class="node"></span><i></i>' + item.columnName +
                    '</div>' + 
                    '<div class="children_' + item.id + ' child"></div>').children(':last-child').data('info', item);
    			flagi = i;
    		}
    	});
    	if(flagi != -1) {
    		edata.splice(flagi, 1);
    	}
    	var flag = 0;
    	var circulationTree = function(data) {
        	var j = data[flag];
        	if (j == undefined) {
        		flag = 0;
        	} else {
        		var $parent = j.parentId ? $addBox.find('.children_' + j.parentId) : '';
	        	var goAppend = function($box) {
	            	$box.append('' +
	                    '<div class="thisCol_' + j.id  + ' parent" data-id="' + j.id + '" data-columnCode="' + j.columnCode + '">' + 
	                    '<span class="node"></span><i></i>' + j.columnName +
	                    '</div>' + 
	                    '<div class="children_' + j.id + ' child"></div>').children(':last-child').data('info', j);
	            	data.splice(flag, 1);
	        	}
	        	if (j.parentId) {
	        		if ($parent.length > 0) {
	        			goAppend($parent);
	        		} else {
	        			flag += 1;
	        		}
	       		} else {
	            	goAppend($addBox);
	            	flag = 0;
	        	};
        	}
        	if (data.length > 0) {
            	circulationTree(data);
        	};
        	var treeList = $addBox.find('div.parent');
    		$.each(treeList, function(i, j) {
    			$(this).next('div.child').find('div.parent').length > 0 ? $(this).addClass('folder') : $(this).addClass('file');
    		});
    	};
    	circulationTree(edata);
    	var stopBubble = function(e) {
        	if (e && e.stopPropagation) {      　　
            	e.stopPropagation();
        	} else {
            	window.event.cancelBubble = true;
            	return false;
        	}
    	};
    	if (opts.onlyLeaf) {
    		$addBox.on("click", 'div.file', function(event) {
    		stopBubble(event);
        	var tagName = event.target.tagName,
            	$_this = tagName == 'DIV' ? $(event.target) : $(event.target).parent(),
    			info = $(this).data('info'),
    			$thisInput = $(this).parents('.bbox').find('.chooseData'),
    			thisName = $_this.text(),
    			thisId = $_this.attr('data-id'),
    			thisCode = $_this.attr('data-columnCode');
    		$contentBox.find('div').removeClass('active');
    		$_this.addClass('active');
    		$thisInput.val(thisName);
    		$thisInput.attr('data-id', thisId);
    		$thisInput.attr('data-columnCode', thisCode);
    		$thisInput.blur();
    		obj.val(thisId);
    		theBox.find('.treeBox').addClass('opennn');
    		if (typeof (callback) == "function") {
    			var thisData = {
    				id: thisId,
    				code: thisCode,
    				name: thisName
    			}
				callback(thisData);
			}
    	});
    	} else {
    		$addBox.on("click", 'div', function(event) {
    		stopBubble(event);
        	var tagName = event.target.tagName,
        		$_this = tagName == 'DIV' ? $(event.target) : $(event.target).parent(),
        		open = $_this.hasClass('open'),
        		info = $(this).data('info'),
    			$thisInput = $(this).parents('.bbox').find('.chooseData'),
    			thisName = $_this.text(),
    			thisId = $_this.attr('data-id'),
    			thisCode = $_this.attr('data-columnCode');
        	if (tagName == 'SPAN') {
        		if (!open) {
            		$_this.addClass('open');
        		} else {
            		$_this.removeClass('open');
        		}
        	} else {
        		$contentBox.find('div').removeClass('active');
    			$_this.addClass('active');
    			$thisInput.val(thisName);
    			$thisInput.attr('data-id', thisId);
    			$thisInput.attr('data-columnCode', thisCode);
    			$thisInput.blur();
    			obj.val(thisId);
    			theBox.find('.treeBox').addClass('opennn');
    			if (typeof (callback) == "function") {
    				var thisData = {
    					id: thisId,
    					code: thisCode,
    					name: thisName
    				}
					callback(thisData);
				}
        	}
    	});
    	}
    	
    	$contentBox.on("click", '.root', function(event) {
    		stopBubble(event);
        	var tagName = event.target.tagName,
            	$_this = tagName == 'DIV' ? $(event.target) : $(event.target).parent(),
    			$thisInput = $(this).parents('.bbox').find('.chooseData'),
    			thisName = $_this.text(),
    			thisId = $_this.attr('data-id'),
    			thisCode = $_this.attr('data-columnCode');
    		$contentBox.find('div').removeClass('active');
    		$_this.addClass('active');
    		$thisInput.val('');
    		$thisInput.attr('data-id', '');
    		$thisInput.attr('data-columnCode', '');
    		$thisInput.blur();
    		obj.val('');
    		theBox.find('.treeBox').addClass('opennn');
    		if (typeof (callback) == "function") {
    			var thisData = {
    				id: thisId,
    				code: thisCode,
    				name: thisName
    			}
				callback(thisData);
			}
    	});
    	theBox.find('.sbox').on('click', function(event) {
    		var $thisTree = $(this).siblings('.treeBox'),
    			showO = $thisTree.hasClass('opennn');
    		showO ? $thisTree.removeClass('opennn') : $thisTree.addClass('opennn');
    	});
    	$contentBox.on('click', 'span.node', function(event) {
        	stopBubble(event);
        	var tagName = event.target.tagName,
            $_this = tagName == 'DIV' ? $(event.target) : $(event.target).parent(),
            open = $_this.hasClass('open');
        	if (!open) {
            	$_this.addClass('open');
        	} else {
            	$_this.removeClass('open');
        	}
    	});
    	theBox.find('.searchLanM').on('keyup', function() {
    		var thisKeyword = $(this).val(),
    			thatVal = '',
    			oldVal = $(this).data('oldVal');
    		$(this).data('oldVal', thisKeyword);
    		if (thisKeyword == oldVal) return;
    		$addBox.html('');
    		if (thisKeyword == '') {
				var newData = [];
				$.each(e, function(i, j) {
					newData.push(j);
				});
				circulationTree(newData);
				return;
    		}
    		$.each(newArr, function(i, j) {
    			thatVal = j.columnName.indexOf(thisKeyword);
    			if (thatVal > -1) {
        			$addBox.append('' +
                    '<div class="thisCol_' + j.id  + ' file parent" data-id="' + j.id + '" data-columnCode="' + j.columnCode + '" style="">' + j.columnName +
                    '<i></i></div>' + 
                    '<div class="children_' + j.id + ' child"></div>').children(':last-child').data('info', j);
    			};
    		});
    	});
    	$(document).on("click",function(e) { 
    		if($(e.target).closest(".bbox").length == 0) { 
    			theBox.find('.treeBox').addClass('opennn'); 
    		} 
    	});
    	if (obj.val() != '') {
    		var thisIds = obj.val();
    			thisIds = thisIds.split(',');
    		$.each(thisIds, function(i, j) {
    			$addBox.find('.thisCol_' + j).click();
    		});
    		console.log(thisIds)
    	}
	}, 'POST');
};

/**
 *	表单数据绑定
 */
$.fn.getForm = function(fdata, callback, childform) {
  var _this = $(this);
  var url = $(this).attr("ly-get");
  if (url != "" && url != undefined) {
    var u = url.match(/\{\{(.+?)\}\}/g);
    if (u != "" && u != undefined) {
      var um = u.toString();
      var up = um.substring(2, um.length - 2);
      var uu = site[up];
      url = url.replace(um, uu);
    }
  } else {
    url = "";
  }
  var data = fdata || {},
    o, p, tp;
  request({
    url: url,
    data: data,
    type: data.rqtype || 'get',
    callback: function(r) {
      if (r.code !== "success") {
        $(".tipbox").showTips({
          text: r.code + ":" + (r.msg || r.desc),
          type: "error"
        });
        // ly.alert(r.msg, function() {
        //   window.history.back();
        // })
        _this.find(".infoBox").hide();
        return;
      }
      var d = r.result;
      if (d instanceof Array) {
        if (childform == "" || childform == undefined) {
          _this.parents(".card").find(".tipbox").ly.toast("getForm配置有误，结果疑似多个表单数组结构，但未配置“childform”参数");
        } else {
          $.each(d, function(i, c) {
            childform.eq(i).databind({
              bdata: c,
              callback: callback
            });
          });
        }
      } else {
        _this.databind({
          bdata: d,
          callback: callback
        });
      }
    }
  });
}

/**
 *	表单数据绑定Two
 */
$.fn.getFormTwo = function(fdata, callback, childform) {
  var _this = $(this);
  var url = $(this).attr("ly-get");
  if (url != "" && url != undefined) {
    var u = url.match(/\{\{(.+?)\}\}/g);
    if (u != "" && u != undefined) {
      var um = u.toString();
      var up = um.substring(2, um.length - 2);
      var uu = site[up];
      url = url.replace(um, uu);
    }
  } else {
    url = "";
  }
  var data = fdata || {},
    o, p, tp;
  request({
    url: url,
    data: data,
    type: data.type || 'get',
    callback: function(r) {
      if (r.code !== 200) {
        $(".tipbox").showTips({
          text: r.code + ":" + (r.msg || r.desc),
          type: "error"
        });
        // ly.alert(r.msg, function() {
        //   window.history.back();
        // })
        _this.find(".infoBox").hide();
        return;
      }
      var d;
      if (r.data.content && (typeof r.data.content) != 'string') {
        d = r.data.content[0]
      } else {
        d = r.data
      }
      if (d instanceof Array) {
        if (childform == "" || childform == undefined) {
          _this.parents(".card").find(".tipbox").ly.toast("getForm配置有误，结果疑似多个表单数组结构，但未配置“childform”参数");
        } else {
          $.each(d, function(i, c) {
            childform.eq(i).databindTwo({
              bdata: c,
              callback: callback
            });
          });
        }
      } else {
        _this.databindTwo({
          bdata: d,
          callback: callback
        });
      }
    }
  });
}

/**
 *	数据绑定
 */
$.fn.databind = function(options) {
  var defaults = {
    bdata: "",
    callback: ""
  }
  var opts = $.extend({}, defaults, options);
  var obj = $(this);
  var d = opts.bdata;
  var _this = $(this);
  var g = 0;
  var n = 0;
  obj.find("[ly-bind]").each(function() {
    o = $(this).attr("ly-bind");
    tp = $(this).attr("ly-type");
    p = getter(d, o) != undefined ? getter(d, o) : "";
    if ($(this).is("input") && $(this).attr("type") != "upvideo" || $(this).is("textarea")) {
      if (p == 0 || p != "") {
        $(this).val(p);
      }
    } else if (typeof($(this).attr("ly-ueidtor")) != "undefined") {
      $(this).html(p);

    } else if (tp == "radio" || tp == "checkbox" || tp == "select" || tp == "screen" || tp == "tree") {
      g++;
      if (p != null && p != undefined) {
        $(this).attr("ly-val", p);
      }
      var name = $(this).attr("name");
      $(this).removeAttr("name");
      var code = $(this).attr("ly-code") || '';
      var val = $(this).attr("ly-val");
      var dis = $(this).attr("disabled") ? true : false;
      var list = $(this).attr("ly-list") || '';
      var max = $(this).attr("max-item");
      var onlyLeaf = $(this).attr("onlyLeaf") != undefined ? true : false;
      if (list != "" && list != undefined) {
        list = JSON.parse(list);
      }
      $(this).getSelect({
        type: tp,
        asName: name,
        code: code,
        default: val,
        list: list,
        disabled: dis,
        maxlength: max,
        onlyLeaf: onlyLeaf
      }, function() {
        n++;
      });
    } else if ($(this).attr("filetype") == "images") {
      if ($(this).attr("data-type") == 'imgs') {
        var h = "";
        var img;
        var uploader_filename = new Array();
        var dis = $(this).attr("disabled") == undefined;
        img = p;
        if ($(this).attr("disabled") != undefined) {
        } else {
          var _this = $(this);
          var listArr = p.split(',');
          for(var i = 0; i < listArr.length; i++) {
            _this.find(".uploadvalid").val(listArr[i]);
            _this.find(".file-list").prepend('<div id="WU_FILE_' + i + '" class="file-item upload-state-done"><img src="' + listArr[i] + '"><input type="hidden" class="filepath" value="' + listArr[i] + '"><div class="info"></div><div class="cancel"><i class="iconfont icon-shanchu1"></i></div><div class="success"></div></div>');
          }
        }
      } else if ($(this).attr("data-type") == 'img') {
        var h = "";
        var img;
        var uploader_filename = new Array();
        var dis = $(this).attr("disabled") == undefined;
        img = p;
        if ($(this).attr("disabled") != undefined) {
        } else {
          h = '<div id="WU_FILE_' + p + '" class="file-item upload-state-done"><img src="' + img + '"><input type="hidden" class="filepath" value="' + img + '"><div class="info"></div><div class="cancel"><i class="iconfont icon-shanchu1"></i></div><div class="success"></div></div>';
        }
        $(this).find(".uploadvalid").val(img);
        $(this).find(".file-list").prepend(h);
      } else {
        var h = "";
        var img;
        var uploader_filename = new Array();
        var dis = $(this).attr("disabled") == undefined;
        $.each(p, function(p, e) {
          //给隐藏信息赋值
          //img = e.src.replace('{{interUrl}}', site.interUrl);
          img = e;
          if ($(this).attr("disabled") != undefined) {
  
          } else {
            h += '<div id="WU_FILE_' + p + '" class="file-item upload-state-done"><img src="' + img.url + '"><input type="hidden" class="filepath" value="' + img.filePath + '" fileName="' + img.fileName + '" fileSize="' + img.fileSize + '" fileType="img.fileType" businessCode="' + img.businessCode + '"><div class="info"></div><div class="cancel"><i class="iconfont icon-shanchu1"></i></div><div class="success"></div></div>';
          }
          uploader_filename.push(img.fileName);
        });
        $(this).find(".uploadvalid").val(uploader_filename);
        $(this).find(".file-list").prepend(h);
      }
    } else if ($(this).attr("filetype") == "*") {
      // var h = "";
      // var img;
      // var uploader_filename = new Array();
      // $.each(p, function(p, e) {
      //   //给隐藏信息赋值
      //   img = e;
      //   h += '<div id="WU_FILE_' + p + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + img.filePath + '" fileName="' + img.fileName + '" fileSize="' + img.fileSize + '" fileType="img.fileType" businessCode="' + img.businessCode + '"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：《' + img.fileName + '》</div><div class="cancel"><span>删除</span></div></div>';
      //   uploader_filename.push(img.fileName);
      // });
      // $(this).find(".uploadvalid").val(uploader_filename);
      // $(this).find(".file-list").prepend(h);
      if (typeof p == 'object') {
        for (var i = 0; i < p.length; i++) {
          $(this).find(".file-list").prepend('<div id="WU_FILE_' + i + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + p[i].filePath + '" fileName="'+ p[i].fileName +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ p[i].filePath +' target="_blank">《' + p[i].fileName + '》</a></div><div class="cancel"><span>删除</span></div></div>');
        }
      } else {
        if (p != "" && p != undefined) {
          var pArr = p.split(',');
          if (pArr.length > 1) {
            var h = "";
            var img;
            var uploader_filename = new Array();
            for (var i = 0; i < pArr.length; i++) {
              var pFileName = pArr[i].split('upload/')[1].split('/')[1];
              $(this).find(".file-list").prepend('<div id="WU_FILE_' + i + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + pArr[i] + '" fileName="'+ pFileName +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ pArr[i] +' target="_blank">《' + pFileName + '》</a></div><div class="cancel"><span>删除</span></div></div>');
            }
          } else if (p.indexOf('upload/') > 0) {
            var pFileName = p.split('upload/')[1].split('/')[1];
            h = '<div id="WU_FILE_' + pFileName + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + p + '" fileName="'+ pFileName +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ p +' target="_blank">《' + pFileName + '》</a></div><div class="cancel"><span>删除</span></div></div>';
            $(this).find(".uploadvalid").val(uploader_filename);
            $(this).find(".file-list").prepend(h);
          } else {
            h = '<div id="WU_FILE_' + p + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + p + '" fileName="'+ p +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ p +' title='+ p +' target="_blank">《' + p + '》</a></div><div class="cancel"><span>删除</span></div></div>';
            $(this).find(".uploadvalid").val(uploader_filename);
            $(this).find(".file-list").prepend(h);
          }
        }
      }
    } else if (tp == "upimg") {
      if (p != "" && p != undefined) {
        // var img = p;
        // $(this).find("input[type=hidden]").val(img.filePath).attr({
        //   "fileName": img.fileName,
        //   "fileSize": img.fileSize,
        //   "fileType": img.fileType,
        //   "businessCode": img.businessCode
        // });
        // $(this).find(".imgbox").html('<img src="' + img.url + '"></div>');
        // $(this).addClass("active");
        var img = p;
        $(this).find("input[type=hidden]").val(img);
        $(this).find(".imgbox").html('<img src="' + img + '"></div>');
        $(this).addClass("active");
      }
    } else if ($(this).attr("type") == "upvideo") {
      if (p != "" && p != undefined) {
        var video = p;
        $(this).val(video.id).attr({
          "aliid": video.aliyunVideoId,
          "cover": video.coverUrl
        });
      }
    } else if (tp != undefined && tp.split(":")[0] == "fun") {
      eval(tp.split(":")[1] + "('" + p + "',this)");
    } else if (tp == "img") {
      var imgitem = '';
      //判断是否位数组
      if (p instanceof Array) {
        $(p).each(function(i) {
          imgitem += '<div class="file-item mt0"><img src=' + p[i].url + '></div>';
        });
      } else if (p.url != "" && p.url != undefined) {
        imgitem += '<div><img src=' + p.url + '></div>';
      } else {
        imgitem += '<div>未上传图片</div>'
      }
      $(this).html(imgitem);
    } else if (tp == "textgroup") {
      p = p.split(",");
      $(this).find("input").each(function(i) {
        $(this).val(p[i]);
      });
    } else if (tp == "text") {
      if ($(this).attr("unit")) {
        $(this).html(p + $(this).attr("unit"));
      } else {
        $(this).html(p);
      }
    } else if (tp == "map") {
      if (p != "" && p != undefined) {
        var map = p;
        $(this).find('span').text(map.addrsName);
        $(this).find('label:eq(0)').text(map.longitude);
        $(this).find('label:eq(1)').text(map.latitude);
      }
    } else if (tp == "showicon") {
      var ii = "icon";
      if (p.indexOf("icon") > -1) {
        $(this).append('<i class="iconshow iconfont-guangming ' + p + '"></i>');
      } else {
        $(this).append('<i class="iconshow iconfont-guangming">' + p + '</i>');
      }
    }
  });
  if (typeof(opts.callback) == "function") {
    var t = setInterval(function() {
      if (g == n) {
        opts.callback(d, _this);
        lyComplete();
        clearInterval(t);
      }
    }, 100)
  } else {
    lyComplete();
  }
}

/**
 *	数据绑定Two
 */
$.fn.databindTwo = function(options) {
  var defaults = {
    bdata: "",
    callback: ""
  }
  var opts = $.extend({}, defaults, options);
  var obj = $(this);
  var d = opts.bdata;
  var _this = $(this);
  var g = 0;
  var n = 0;
  obj.find("[ly-bind]").each(function() {
    o = $(this).attr("ly-bind");
    tp = $(this).attr("ly-type");
    p = getter(d, o) != undefined ? getter(d, o) : "";
    if ($(this).is("input") && $(this).attr("type") != "upvideo" || $(this).is("textarea")) {
      if (p == 0 || p != "") {
        $(this).val(p);
      }
    } else if (typeof($(this).attr("ly-ueidtor")) != "undefined") {
      $(this).html(p);

    } else if (tp == "radio" || tp == "checkbox" || tp == "select" || tp == "screen" || tp == "tree") {
      g++;
      if (p != null && p != undefined) {
        $(this).attr("ly-val", p);
      }
      var name = $(this).attr("name");
      $(this).removeAttr("name");
      var code = $(this).attr("ly-code") || '';
      var val = $(this).attr("ly-val");
      var dis = $(this).attr("disabled") ? true : false;
      var list = $(this).attr("ly-list") || '';
      var max = $(this).attr("max-item");
      var onlyLeaf = $(this).attr("onlyLeaf") != undefined ? true : false;
      if (list != "" && list != undefined) {
        list = JSON.parse(list);
      }
      $(this).getSelect({
        type: tp,
        asName: name,
        code: code,
        default: val,
        list: list,
        disabled: dis,
        maxlength: max,
        onlyLeaf: onlyLeaf
      }, function() {
        n++;
      });
    } else if ($(this).attr("filetype") == "images") {
      if ($(this).attr("data-type") == 'imgs') {
        var h = "";
        var img;
        var uploader_filename = new Array();
        var dis = $(this).attr("disabled") == undefined;
        img = p;
        if ($(this).attr("disabled") != undefined) {
        } else {
          var _this = $(this);
          var listArr = p.split(',');
          for(var i = 0; i < listArr.length; i++) {
            _this.find(".uploadvalid").val(listArr[i]);
            _this.find(".file-list").prepend('<div id="WU_FILE_' + i + '" class="file-item upload-state-done"><img src="' + listArr[i] + '"><input type="hidden" class="filepath" value="' + listArr[i] + '"><div class="info"></div><div class="cancel"><i class="iconfont icon-shanchu1"></i></div><div class="success"></div></div>');
          }
        }
      } else if ($(this).attr("data-type") == 'img') {
        var h = "";
        var img;
        var uploader_filename = new Array();
        var dis = $(this).attr("disabled") == undefined;
        img = p;
        if ($(this).attr("disabled") != undefined) {
        } else {
          h = '<div id="WU_FILE_' + p + '" class="file-item upload-state-done"><img src="' + img + '"><input type="hidden" class="filepath" value="' + img + '"><div class="info"></div><div class="cancel"><i class="iconfont icon-shanchu1"></i></div><div class="success"></div></div>';
        }
        $(this).find(".uploadvalid").val(img);
        $(this).find(".file-list").prepend(h);
      }
    } else if ($(this).attr("filetype") == "*") {
      if (p != "" && p != undefined) {
        var pArr = p.split(',');
        if (pArr.length > 1) {
          var h = "";
          var img;
          var uploader_filename = new Array();
          // $.each(p, function(p, e) {
          //   //给隐藏信息赋值
          //   img = e;
          //   h += '<div id="WU_FILE_' + p + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + img.filePath + '" fileName="' + img.fileName + '" fileSize="' + img.fileSize + '" fileType="img.fileType" businessCode="' + img.businessCode + '"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：《' + img.fileName + '》</div><div class="cancel"><span>删除</span></div></div>';
          //   uploader_filename.push(img.fileName);
          // });
          for (var i = 0; i < pArr.length; i++) {
            var pFileName = pArr[i].split('upload/')[1].split('/')[1];
            $(this).find(".file-list").prepend('<div id="WU_FILE_' + i + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + pArr[i] + '" fileName="'+ pFileName +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ pArr[i] +' target="_blank">《' + pFileName + '》</a></div><div class="cancel"><span>删除</span></div></div>');
          }
          // $(this).find(".uploadvalid").val(uploader_filename);
        } else if (p.indexOf('upload/') > 0) {
          var pFileName = p.split('upload/')[1].split('/')[1];
          h = '<div id="WU_FILE_' + pFileName + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + p + '" fileName="'+ pFileName +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ p +' target="_blank">《' + pFileName + '》</a></div><div class="cancel"><span>删除</span></div></div>';
          $(this).find(".uploadvalid").val(uploader_filename);
          $(this).find(".file-list").prepend(h);
        } else {
          h = '<div id="WU_FILE_' + p + '" class="file-item annex-item upload-state-done"><input type="hidden" class="filepath" value="' + p + '" fileName="'+ p +'"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：<a href='+ p +' title='+ p +' target="_blank">《' + p + '》</a></div><div class="cancel"><span>删除</span></div></div>';
          $(this).find(".uploadvalid").val(uploader_filename);
          $(this).find(".file-list").prepend(h);
        }
      }
    } else if (tp == "upimg") {
      if (p != "" && p != undefined) {
        var img = p;
        $(this).find("input[type=hidden]").val(img);
        $(this).find(".imgbox").html('<img src="' + img + '"></div>');
        $(this).addClass("active");
      }
    } else if ($(this).attr("type") == "upvideo") {
      if (p != "" && p != undefined) {
        var video = p;
        $(this).val(video.id).attr({
          "aliid": video.aliyunVideoId,
          "cover": video.coverUrl
        });
      }
    } else if (tp != undefined && tp.split(":")[0] == "fun") {
      eval(tp.split(":")[1] + "('" + p + "',this)");
    } else if (tp == "img") {
      var imgitem = '';
      //判断是否位数组
      if (p instanceof Array) {
        $(p).each(function(i) {
          imgitem += '<div class="file-item mt0"><img src=' + p[i].url + '></div>';
        });
      } else if (p.url != "" && p.url != undefined) {
        imgitem += '<div><img src=' + p.url + '></div>';
      } else {
        imgitem += '<div>未上传图片</div>'
      }
      $(this).html(imgitem);
    } else if (tp == "textgroup") {
      p = p.split(",");
      $(this).find("input").each(function(i) {
        $(this).val(p[i]);
      });
    } else if (tp == "text") {
      if ($(this).attr("unit")) {
        $(this).html(p + $(this).attr("unit"));
      } else {
        $(this).html(p);
      }
    } else if (tp == "map") {
      if (p != "" && p != undefined) {
        var map = p;
        $(this).find('span').text(map.addrsName);
        $(this).find('label:eq(0)').text(map.longitude);
        $(this).find('label:eq(1)').text(map.latitude);
      }
    } else if (tp == "showicon") {
      var ii = "icon";
      if (p.indexOf("icon") > -1) {
        $(this).append('<i class="iconshow iconfont-guangming ' + p + '"></i>');
      } else {
        $(this).append('<i class="iconshow iconfont-guangming">' + p + '</i>');
      }
    }
  });
  if (typeof(opts.callback) == "function") {
    var t = setInterval(function() {
      if (g == n) {
        opts.callback(d, _this);
        lyComplete();
        clearInterval(t);
      }
    }, 100)
  } else {
    lyComplete();
  }
}

/**
 *	创建空表单
 */
$.fn.createForm = function(callback) {
  var _this = $(this);
  var g = 0;
  var n = 0;
  _this.find("[ly-bind]").each(function() {
    var tp = $(this).attr("ly-type");
    if (tp == "radio" || tp == "checkbox" || tp == "select" || tp == "screen" || tp == "tree") {
      g++;
      var code = $(this).attr("ly-code");
      var dis = $(this).attr("disabled") ? true : false;
      var list = $(this).attr("ly-list");
      var max = $(this).attr("max-item");
      var onlyLeaf = $(this).attr("onlyLeaf") != undefined ? true : false;
      if (list != "" && list != undefined) {
        list = JSON.parse(list);
      }
      var name = $(this).attr("name");
      $(this).removeAttr("name");
      $(this).getSelect({
        type: tp,
        asName: name,
        code: code,
        list: list,
        disabled: dis,
        maxlength: max,
        onlyLeaf: onlyLeaf
      }, function() {
        n++;
      });
    }
  });
  if (typeof(callback) == "function") {
    var t = setInterval(function() {
      if (g == n) {
        lyComplete();
        clearInterval(t);
        callback(_this);
      }
    }, 100)
  } else {
    lyComplete();
  }
}

function assignment(obj, path) {
  if (!path) return obj;
  var keys = path.split('.');
  var key;
  var oo = '{"';
  var len = keys.length;
  for (var i = 0; i < len; i++) {
    key = keys[i];
    if (i < len - 1) {
      oo = oo + key + '":{"';
    } else {
      oo = oo + key + '"';
    }
  }
  oo += ':"' + obj + '"';
  for (var i = 0; i < len - 1; i++) {
    key = keys[i].trim();
    oo += "}";
  }
  oo += '}';
  var d = JSON.parse($.trim(oo));
  return d;
}
/**
 *	提交表单
 */
$.fn.submitForm = function(set, goto, altype, submitWord) {
  var _this = $(this);
  _this.siblings(".btnBox").find(".btn").prop("disabled", true);
  _this.parents(".card").showloading();
  var url = set.url || $(this).attr("ly-post");
  delete set.url;
  var info = _this.submitData();
  var data = $.extend({}, info, set);
  if (submitWord != "" && submitWord != undefined) {
    var at = {};
    at[submitWord] = data;
    data = at;
  }
  if (url != "" && url != undefined) {
    var u = url.match(/\{\{(.+?)\}\}/g);
    if (u != "" && u != undefined) {
      var um = u.toString();
      var up = um.substring(2, um.length - 2);
      var uu = site[up];
      url = url.replace(um, uu);
    }
  } else {
    url = "";
  }
  request({
    url: url,
    data: data,
    contentType: '',
    ajaxform: 'ture',
    callback: function(r) {
      if (r.code != "200") {
        ly.alert(r.msg);
        _this.find(".infoBox").hide();
        _this.siblings(".btnBox").find(".btn").prop("disabled", false);
        return;
      } else {
        if (typeof(altype) == "function") {
          altype(r);
        } else if (altype === "" || altype === undefined || altype == "alert") {
          ly.alert(r.desc, function() {
            if (goto != "" && goto != undefined) {
              ly.goto(goto);
            } else {}
          });
        } else if (altype == "toast") {
          ly.toast(r.msg);
          $("body").showloading();
          setTimeout(function() {
              if (goto != "" && goto != undefined) {
                ly.goto(goto);
              }
            },
            1000);
        } else if (altype == "none") {
          $("body").showloading();
          setTimeout(function() {
              if (goto != "" && goto != undefined) {
                ly.goto(goto);
              }
            },
            1000);
        } else if (altype == "refresh") {
          ly.alert("保存成功", function() {
            window.location.reload()
          });

        }
      }
    }
  });
}
/**
 * 获取提交参数
 */
$.fn.submitData = function(set) {
  var _this = $(this);
  var info = {};
  _this.find("[ly-bind]").each(function() {
    info = $.extend(true, info, assignment($(this).val().replace(/\n/g, "") || $(this).find("select").val() || $(this).find("input:checked").val() || "", $(this).attr("ly-bind")));
    if ($(this).attr("ly-type") == "checkbox") {
      var cv = "";
      var _obj = $(this);
      if (_obj.find("input:checked").length > 0) {
        _obj.find("input:checked").each(function(i) {
          if (i < _obj.find("input:checked").length - 1) {
            cv += $(this).val() + ",";
          } else {
            cv += $(this).val();
          }
        });
      } else {
        cv = "";
      }
      info = $.extend(true, info, assignment(cv || "", _obj.attr("ly-bind")));
    }
    if ($(this).attr("ly-type") == "tree") {
      info = $.extend(true, info, assignment($(this).next(".thisbox").find(".chooseData").attr("data-val") || "", $(this).attr("ly-bind")));
    }
    if ($(this).attr("ly-type") == "upimg") {
      var tub = {};
      tub.filePath = $(this).find("input").val();
      tub.fileName = $(this).find("input").attr("fileName");
      tub.fileSize = $(this).find("input").attr("fileSize");
      tub.fileType = $(this).find("input").attr("fileType");
      // tub.businessCode = $(this).find("input").attr("businessCode");
      info[$(this).attr("ly-bind")] = tub || "";
    }
    if ($(this).attr("type") == "simple-uploader" || $(this).attr("type") == "material-uploader") {
      var iv = new Array();
      $(this).find(".filepath").each(function(i) {
        var o = {
          // 'businessCode': $(this).attr("businessCode"),
          'fileType': $(this).attr("fileType"),
          'fileName': $(this).attr("fileName"),
          'fileSize': $(this).attr("fileSize"),
          'filePath': $(this).val()
        };
        iv.push(o);
      });
      info[$(this).attr("ly-bind")] = iv || "";
    }
    if ($(this).attr("ly-type") == "textgroup") {
      var tv = "";
      var _obj = $(this);
      _obj.find("input").each(function(i) {
        if (i < _obj.find("input").length - 1) {
          tv += $(this).val() + ",";
        } else {
          tv += $(this).val();
        }
      });
      info = $.extend(true, info, assignment(tv || "", _obj.attr("ly-bind")));
    }
  });
  var data = $.extend({}, info, set);
  console.log(data);
  return data;
}
/**
 *	查看数据
 */
$.fn.getView = function(vdata, callback, type) {
  var _this = $(this);
  var url = $(this).attr("ly-get");
  var type = type || "get";
  var u = url.match(/\{\{(.+?)\}\}/g);
  if (u != "" && u != undefined) {
    var um = u.toString();
    var up = um.substring(2, um.length - 2);
    var uu = site[up];
    url = url.replace(um, uu);
  }
  var data = vdata || {},
    o;
  request({
    url: url,
    data: data,
    type: type,
    callback: function(r) {
      var d = r.result;
      if (r.code !== "success") {
        // _this.find(".tipbox").showTips({
        //   text: r.code + ":" + r.desc,
        //   type: "error"
        // });
        ly.alert(r.msg, function() {
          // window.history.back();
        })
        _this.find(".infoBox").hide();
        return;
      }
      _this.find("[ly-bind]").each(function() {
        var _obj = $(this);
        var _item = _obj.attr("ly-bind");
        //var _value = d[_item];
        var _value = getter(d, _item) != undefined ? getter(d, _item) : "";
        var _itemtype = _obj.attr("ly-type");
        if (_itemtype == "text") {
          _obj.html(_value);
        } else if (_itemtype == "img") {
          //图片查看显示
          var imgitem = '';
          //判断是否位数组
          if (_value instanceof Array) {
            $(_value).each(function(i) {
              imgitem += '<div class="file-item mt0"><img src=' + _value[i].url + '></div>';
            });
          } else if (_value.url != "" && _value.url != undefined) {
            imgitem += '<div><img src=' + _value.url + '></div>';
          } else {
            imgitem += '<div>未上传图片</div>'
          }
          _obj.html(imgitem);
        } else if (_itemtype == "textgroup") {
          _value = _value.split(",");
          $(this).find("[ly-type=text]").each(function(i) {
            $(this).html(_value[i]);
          });
        } else if (_itemtype == "file") {
          //附件查看显示
          var fileitem = '';
          //判断是否位数组
          if (_value instanceof Array) {
            $(_value).each(function(i) {
              if (_value[i].fileName != undefined) {
                fileitem += '<div class="file-item annex-item"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：《' + _value[i].fileName + '》</div></div>';
              }
            });
          } else {
            if (_value.fileName != undefined) {
              fileitem += '<div class="file-item annex-item"><div class="info"><i class="iconfont-guangming icon-iconfontfile"></i>附件：《' + _value.fileName + '》</div></div>';
            } else {
              fileitem += '未上传附件';
            }
          }
          _obj.html(fileitem);
        } else if (_itemtype == "showicon") {
          var ii = "icon";
          if (ii.indexOf(p) > -1) {
            $(this).append('<i class="iconshow iconfont-guangming ' + p + '"></i>');
          } else {
            $(this).append('<i class="iconshow iconfont-guangming">' + p + '</i>');
          }
        } else if (_itemtype != undefined && _itemtype.split(":")[0] == "fun") {
          eval(_itemtype.split(":")[1] + "('" + _value + "',this)");
        }
      });
      lyComplete();
      if (typeof(callback) == "function") {
        callback(d, _this);
      }
    }
  });
}
/**
 *	字典 单选/下拉
 */
$.fn.getSelect = function(options, callback) {
  var dis = $(this).attr("disabled") == undefined ? false : true;
  var dft = $(this).attr("ly-val");
  var data = [];
  var obj = $(this),
    h = "",
    defaults = {
      label: "",
      type: "select",
      asName: "select",
      code: "",
      list: {},
      maxlength: '200',
      default: dft,
      disabled: dis,
      enable: []
    }
  var validate = {
    "placeholder": $(this).attr("placeholder"),
    "data-tip": $(this).attr("data-tip"),
    "data-valid": $(this).attr("data-valid"),
    "data-error": $(this).attr("data-error")
  };
  var opts = $.extend({}, defaults, options);
  if ($(this).attr("id") == "s1") {}
  var s, d, list = {};
  obj.html("");
  if (opts.code != "") {
    request({
      url: site.dictionUrl,
      data: { code: opts.code },
      type: "get",
      callback: function(e) {
        var e = d.result;
        list = $.grep(e, function(d) {
          return d.code == opts.code.split("|")[0];
        });
        if (opts.type == "select") {
          for (var i = 0; i < opts.list.length; i++) {
            var at = opts.list[i].attr1 ? opts.list[i].attr1 : "";
            s = opts.list[i].value == opts.default ? "selected" : "";
            h += '<option value="' + opts.list[i].value + '"  ' + s + '>' + opts.list[i].display + '</option>';
          }
          obj.html(h);
        } else if (opts.type == "radio") {
          for (var i = 0; i < opts.list.length; i++) {
            s = opts.list[i].value == opts.
            default ? "checked" : "";
            d = opts.disabled ? "disabled" : "";
            h += '<label class="rad"><input type="radio" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
          }
          for (var i = 0; i < list.length; i++) {
            s = list[i].value == opts.
            default ? "checked" : "";
            d = opts.disabled ? "disabled" : "";
            h += '<label class="rad"><input type="radio" value="' + list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + list[i].display + '</label>';
          }
          obj.append(h);
        } else if (opts.type == "checkbox") {
          var v;
          if (opts.default != "" && opts.default != undefined) {
            v = opts.default.split(",");
          } else {
            v = "";
          }
          for (var i = 0; i < opts.list.length; i++) {
            $.each(v,
              function(n, d) {
                if (d == opts.list[i].value) {
                  s = "checked";
                  return false;
                } else {
                  s = "";
                }
              });
            d = opts.disabled ? "disabled" : "";
            h += '<label class="chk"><input type="checkbox" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
          }
          for (var i = 0; i < list.length; i++) {
            $.each(v,
              function(n, d) {
                if (d == list[i].value) {
                  s = "checked";
                  return false;
                } else {
                  s = "";
                }
              });
            d = opts.disabled ? "disabled" : "";
            h += '<label class="chk"><input type="checkbox" value="' + list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + list[i].display + '</label>';
          }
          obj.append(h);
        } else if (opts.type == "screen") {
          d = opts.disabled ? "disabled" : "";
          h += '<div class="label">' + opts.label + '</div><ul class="screen">';
          if (d == "") {
            h += '<li><label><input name="' + opts.asName + '" type="radio" checked value =""><b>全部</b></label></li>';
          }
          for (var i = 0; i < opts.list.length; i++) {
            s = opts.list[i].value == opts.
            default ? "checked" : "";
            h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + ((d && opts.enable.length > 0 && opts.enable.indexOf(opts.list[i].value) > -1) ? '' : d) + ' value = "' + opts.list[i].value + '"><b>' + opts.list[i].display + '</b></label></li>';
          }
          for (var i = 0; i < list.length; i++) {
            s = list[i].value == opts.
            default ? "checked" : "";
            h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + ((d && opts.enable.length > 0 && opts.enable.indexOf(list[i].value) > -1) ? '' : d) + ' value = "' + list[i].value + '"><b>' + list[i].display + '</b></label></li>';
          }
          h += '</ul>';
          obj.append(h);
        }
        if (typeof(callback) == "function") {
          callback(obj);
        }
      }
    });
  } else {
    if (opts.type == "select") {
      for (var i = 0; i < opts.list.length; i++) {
        var at = opts.list[i].attr1 ? opts.list[i].attr1 : "";
        s = opts.list[i].value == opts.default ? "selected" : "";
        h += '<option value="' + opts.list[i].value + '"  ' + s + '>' + opts.list[i].display + '</option>';
      }
      obj.html(h);
    } else if (opts.type == "radio") {
      for (var i = 0; i < opts.list.length; i++) {
        s = opts.list[i].value == opts.
        default ? "checked" : "";
        d = opts.disabled ? "disabled" : "";
        h += '<label class="rad"><input type="radio" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
      }
      obj.append(h);
    } else if (opts.type == "checkbox") {
      var v;
      if (opts.default != "" && opts.default != undefined) {
        v = opts.default.split(",");
      } else {
        v = "";
      }
      for (var i = 0; i < opts.list.length; i++) {

        $.each(v, function(n, d) {
          if (d == opts.list[i].value) {
            s = "checked";
            return false;
          } else {
            s = "";
          }
        });
        d = opts.disabled ? "disabled" : "";
        h += '<label class="chk"><input type="checkbox" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
      }
      obj.append(h);
    } else if (opts.type == "screen") {
      d = opts.disabled ? "disabled" : "";
      h += '<div class="label">' + opts.label + '</div><ul class="screen">';
      if (d == "") {
        h += '<li><label><input name="' + opts.asName + '" type="radio" checked value =""><b>全部</b></label></li>';
      }
      for (var i = 0; i < opts.list.length; i++) {
        s = opts.list[i].value == opts.
        default ? "checked" : "";
        h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + d + ' value = "' + opts.list[i].value + '"><b>' + opts.list[i].display + '</b></label></li>';
      }
      h += '</ul>';
      obj.append(h);
    } else if (opts.type == "screenTwo") {
      d = opts.disabled ? "disabled" : "";
      h += '<div class="label">' + opts.label + '</div><ul class="screen">';
      for (var i = 0; i < opts.list.length; i++) {
        s = opts.list[i].value == opts.
        default ? "checked" : "";
        h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + ((d && opts.enable.length > 0 && opts.enable.indexOf(opts.list[i].value) > -1) ? '' : d) + ' value = "' + opts.list[i].value + '"><b>' + opts.list[i].display + '</b></label></li>';
      }
      for (var i = 0; i < list.length; i++) {
        s = list[i].value == opts.
        default ? "checked" : "";
        h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + ((d && opts.enable.length > 0 && opts.enable.indexOf(list[i].value) > -1) ? '' : d) + ' value = "' + list[i].value + '"><b>' + list[i].display + '</b></label></li>';
      }
      h += '</ul>';
      obj.append(h);
    }
    if (typeof(callback) == "function") {
      callback(obj);
    }
  }
};

$.fn.getSelectM = function (options, callback) {
  var dis = $(this).attr("disabled") == undefined ? false : true;
  var dft = $(this).attr("ly-val");
  var data = [];
  var obj = $(this),
    h = "",
    defaults = {
      label: "",
      type: "select", // radio,select,checkbox,screen
      asName: "select",
      code: "",
      list: {},
      maxlength: '200',
      default: dft,
      disabled: dis,
      enable: []
    }
  var validate = {
    "placeholder": $(this).attr("placeholder"),
    "data-tip": $(this).attr("data-tip"),
    "data-valid": $(this).attr("data-valid"),
    "data-error": $(this).attr("data-error")
  };
  var opts = $.extend({}, defaults, options);
  if ($(this).attr("id") == "s1") {
  }
  var s, d, list = {};
  obj.html("");
  if (opts.code != "") {
    var date ={"code":opts.code};
    request({
      url: site.apiUrl+"/dictBasic/selectDictBasicsWithGroup",
      data:date,
      type:"get",
     callback:function (d) {
      var e = d.result;
      list = $.grep(e, function (d) {
        return d.code == opts.code.split(",")[0];
      });
      if (opts.type == "select") {
        d = opts.disabled ? "disabled" : "";
        if (obj.hasClass("required")) {
          obj.removeClass("required");
          h += '<select ' + d + ' name=' + opts.asName + ' id=' + opts.asName + 'st class="required" placeholder="' + validate.placeholder + '" data-tip="' + validate["data-tip"] + '" data-valid="' + validate["data-valid"] + '" data-error="' + validate["data-error"] + '">';
        } else {
          h += '<select ' + d + ' name=' + opts.asName + ' id=' + opts.asName + 'st >';
        }

        for (var i = 0; i < opts.list.length; i++) {
          s = opts.list[i].value == opts.default ? "selected" : "";
          h += '<option value="' + opts.list[i].value + '"  ' + s + '>' + opts.list[i].display + '</option>';
        }
        for (var i = 0; i < list.length; i++) {
          var at = list[i].attr1?list[i].attr1:"";
          s = list[i].value == opts.default ? "selected" : "";
          h += '<option nextcode="'+at+'" value="' + list[i].value + '"  ' + s + '>' + list[i].display + '</option>';
        }
        h += '</select>';
        obj.append(h);
        $('select[name=' + opts.asName + ']').selectseach();
      } else if (opts.type == "radio") {
        for (var i = 0; i < opts.list.length; i++) {
          s = opts.list[i].value == opts.default ? "checked" : "";
          d = opts.disabled ? "disabled" : "";
          h += '<label class="rad"><input type="radio" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
        }
        for (var i = 0; i < list.length; i++) {
          s = list[i].value == opts.default ? "checked" : "";
          d = opts.disabled ? "disabled" : "";
          h += '<label class="rad"><input type="radio" value="' + list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + list[i].display + '</label>';
        }
      obj.append(h);
      } else if (opts.type == "checkbox") {
        var v;
        if (opts.default != "" && opts.default != undefined) {
          v = opts.default.split(",");
        } else {
          v = "";
        }
        for (var i = 0; i < opts.list.length; i++) {
          $.each(v, function (n, d) {
            if (d == opts.list[i].value) {
              s = "checked";
              return false;
            } else {
              s = "";
            }
          });
          d = opts.disabled ? "disabled" : "";
          h += '<label class="chk"><input type="checkbox" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
        }
        for (var i = 0; i < list.length; i++) {
          $.each(v, function (n, d) {
            if (d == list[i].value) {
              s = "checked";
              return false;
            } else {
              s = "";
            }
          });
          //s = list[i].value == opts.default ? "checked" : "";
          d = opts.disabled ? "disabled" : "";
          h += '<label class="chk"><input type="checkbox" value="' + list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + list[i].display + '</label>';
        }
        obj.append(h);
      } else if (opts.type == "screen") {
        d = opts.disabled ? "disabled" : "";
        h += '<div class="label">' + opts.label + '</div><ul class="screen">';
        if (d == "") {
          h += '<li><label><input name="' + opts.asName + '" type="radio" checked value =""><b>全部</b></label></li>';
        }
        for (var i = 0; i < opts.list.length; i++) {
          
          s = opts.list[i].value == opts.default ? "checked" : "";
          // (d && opts.enable.length > 0 && opts.enable.indexOf(opts.list[i].value) > -1) ? '' : 
          h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + ((d && opts.enable.length > 0 && opts.enable.indexOf(opts.list[i].value) > -1) ? '' : d) + ' value = "' + opts.list[i].value + '"><b>' + opts.list[i].display + '</b></label></li>';
        }
        for (var i = 0; i < list.length; i++) {
          s = list[i].value == opts.default ? "checked" : "";
          // (d && opts.enable.length > 0 && opts.enable.indexOf(list[i].value) > -1) ? '' : 
          h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + ((d && opts.enable.length > 0 && opts.enable.indexOf(list[i].value) > -1) ? '' : d) + ' value = "' + list[i].value + '"><b>' + list[i].display + '</b></label></li>';
        }
        h += '</ul>';
        obj.append(h);
      } else if (opts.type == "tree") {
        var hasbox = obj.next('.thisbox');
        if (hasbox.length > 0) {
          obi = obj.next('.thisbox');
          obi.html('');
        } else {
          obj.after('<div class="thisbox"></div>');
          obi = obj.next('.thisbox');
        }
        obj.hide();
        
        var edata = [],
          newArr = [];
        $.each(e, function(i, j) {
          edata.push(j);
          newArr.push(j);
        });
        var plach = validate.placeholder ? validate.placeholder : '';
        console.log(opts.asName);
        h = '<div class="bbox" style="position:relative;width:100%;">' +
          '<div class="ipt dm sbox" style="position:relative;display:block;width:100%;max-width:100%;min-width:100%;margin:0;">' +
          '<span class="mm zhankai"></span>' +
          '<nobr>';
          if (obj.hasClass("required")) {
            obj.removeClass("required");
            h+='<input class="chooseData required" type="text" readonly style="width:100%;height:24px;padding:10px 0;cursor:default;" name="' + opts.asName + '" maxlength="' + opts.maxlength + '" placeholder="' + plach + '"  data-valid="'+validate["data-valid"]+'" data-error="'+validate["data-error"]+'"/>' ;
          }
          else {

            h+='<input class="chooseData" type="text" readonly style="width:100%;height:24px;padding:10px 0;cursor:default;" name="' + opts.asName + '" maxlength="' + opts.maxlength + '" placeholder="' + plach + '"/>';
          }
          h+='</nobr>' +
          '</div>' +
          '<div class="treeBox opennn" style="position:absolute;margin-top: 1px;width:100%;height: 300px;overflow: scroll;border: 1px #ccc solid;border-radius: 2px;z-index: 999;background-color: #fff;">' +
          '<div style="height:34px;line-height:34px;padding:0 8px;font-size:14px;border-bottom:1px solid #d4dce5;background-color:#fff;">' +
          '<input class="searchLanM" type="text" style="width:93%;height:90%;" placeholder="请输入栏目名称" /><i class="iconfont icon-search pointer"></i>' +
          '</div>' +
          '<ul class="treeList" style="padding-left:5px;margin-top:5px;"></ul>' +
          '</div>' +
          '</div>';
        
        obi.append(h);
        if (e.length == 0) return;
        var thmaxlength = opts.maxlength == '' ? 200 : opts.maxlength;
          var $addBox = obi.find('ul.treeList');
          var circulationTree = function(data) {
                  var newarr = [];    
                  var newarr2 = [];   
                      if(data.length>0){
                          for(var i=0;i<data.length;i++){
                              var pid = data[i].parentId||"";
                              if(pid==""){
                                  $addBox.append('<li class="tree' + data[i].value + '" data-val="' + data[i].value + '"><i class="iconfont icon-expand node" style="margin-right:5px;"></i>' +
                                  '<i class="iconfont icon-qiyong" style="margin-right:5px;"></i>' + data[i].display +
                                  '<ul class="children_' + data[i].id + ' mL15 opennn"></ul>' +
                                  '</li>').children(':last-child').data('info', data[i]);
                              }else{
                                  newarr.push(data[i]);
                              }
                          }
                          $.each(newarr,function(n1,t1){
                              var $parent = $addBox.find('.children_' + t1.parentId);
                              if($parent.length>0){
                                  $parent.append('<li class="tree' + t1.value + '" data-val="' + t1.value + '"><i class="iconfont icon-expand node" style="margin-right:5px;"></i>' +
                                  '<i class="iconfont icon-qiyong" style="margin-right:5px;"></i>' + t1.display +
                                  '<ul class="children_' + t1.id + ' mL15 opennn"></ul>' +
                                  '</li>').children(':last-child').data('info', t1);
                              }else{
                                  newarr2.push(t1);
                              }
                          })
                      }
              //还有数据时，继续执行
              if (newarr2.length > 0) {
                  circulationTree(newarr2);
              };
              var treeListLi = $addBox.find('li');
              $.each(treeListLi, function(i, j) {
              if ($(this).find('ul li').length > 0) {

              } else {
                $(this).addClass('isLeaf');
                $(this).find('i.node').addClass('hideee');
              }
            });
            // $.each(treeListLi, function(i, j) {
            // 	$(this).find('ul li').length > 0 ? '' : $(this).find('i.node').addClass('hideee');
            // });
                      
          };

          circulationTree(edata);
          var stopBubble = function(e) {
              if (e && e.stopPropagation) {      　　
                  e.stopPropagation();
              } else {
                  window.event.cancelBubble = true;
                  return false;
              }
          };
        $addBox.on("mouseover mouseout", 'li', function(event) {
          stopBubble(event);
              if (event.type == "mouseover") {
                  $(this).addClass('hovered');
              } else if (event.type == "mouseout") {
                  $(this).removeClass('hovered');
              }
          });
          if (opts.onlyLeaf) {
            $addBox.on("click", 'li.isLeaf', function(event) {
            stopBubble(event);
            var choosed = $(this).hasClass('choosed'),
              info = $(this).data('info'),
              $thisInput = $(this).parents('.bbox').find('.chooseData'),
              cdata = $thisInput.val(),
              cval = $thisInput.attr('data-val');
            var hasNu = cval ? cval.split(',') : '';
            if (choosed) {
              $(this).removeClass('choosed');
              var arrd = cdata.split(','),
                arrv = cval.split(',');
              $.each(arrv, function(i, j) {
                if (info.value == j) {
                  arrv.splice($.inArray(j, arrv), 1);
                }
                cval = arrv.join(',');
                $thisInput.attr('data-val', cval);
              });
              $.each(arrd, function(i, j) {
                if (info.display == j) {
                  arrd.splice(arrd.indexOf(j), 1);
                  cdata = arrd.join(',');
                  $thisInput.val(cdata);
                  return false;
                }
              });
            } else {
              if (opts.choice || thmaxlength == 1) {
                $thisInput.val(info.display);
                $thisInput.attr('data-val', info.value);
                $addBox.find('li').removeClass('choosed');
                $(this).addClass('choosed');
              } else {
                if (hasNu.length == thmaxlength) {
                  ly.toast("最大允许选择数为" + opts.maxlength);
                } else {
                  $(this).addClass('choosed');
                  if (cdata == '') {
                    $thisInput.val(info.display);
                    $thisInput.attr('data-val', info.value);
                  } else {
                    cdata += ',' + info.display;
                    cval += ',' + info.value;
                    $thisInput.val(cdata);
                    $thisInput.attr('data-val', cval);
                  }
                }
              }
            }
              $thisInput.blur();
          });
          } else {
            $addBox.on("click", 'li', function(event) {
              stopBubble(event);
              var choosed = $(this).hasClass('choosed'),
                info = $(this).data('info'),
                $thisInput = $(this).parents('.bbox').find('.chooseData'),
                cdata = $thisInput.val(),
                cval = $thisInput.attr('data-val');
              var hasNu = cval ? cval.split(',') : '';
              if (choosed) {
                $(this).removeClass('choosed');
                var arrd = cdata.split(','),
                  arrv = cval.split(',');
                $.each(arrv, function(i, j) {
                  if (info.value == j) {
                    arrv.splice($.inArray(j, arrv), 1);
                  }
                  cval = arrv.join(',');
                  $thisInput.attr('data-val', cval);
                });
                $.each(arrd, function(i, j) {
                  if (info.display == j) {
                    arrd.splice(arrd.indexOf(j), 1);
                    cdata = arrd.join(',');
                    $thisInput.val(cdata);
                    return false;
                  }
                });
              } else {
                if (opts.choice || thmaxlength == 1) {
                  $thisInput.val(info.display);
                  $thisInput.attr('data-val', info.value);
                  $addBox.find('li').removeClass('choosed');
                  $(this).addClass('choosed');
                } else {
                  if (hasNu.length == thmaxlength) {
                    ly.toast("最大允许选择数为" + opts.maxlength);
                  } else {
                    $(this).addClass('choosed');
                    if (cdata == '') {
                      $thisInput.val(info.display);
                      $thisInput.attr('data-val', info.value);
                    } else {
                      cdata += ',' + info.display;
                      cval += ',' + info.value;
                      $thisInput.val(cdata);
                      $thisInput.attr('data-val', cval);
                    }
                  }
                }
              }
                $thisInput.blur();
          });
          }
          
          obi.find('.sbox').on('click', function(event) {
            var $thisTree = $(this).siblings('.treeBox'),
              showO = $thisTree.hasClass('opennn');
            showO ? $thisTree.removeClass('opennn') : $thisTree.addClass('opennn');
          });
          $addBox.on('click', 'li i.node', function(event) {
              stopBubble(event);
              var tagName = event.target.tagName,
                  $_this = tagName == 'LI' ? $(event.target) : $(event.target).parent(),
                  open = $_this.children('ul').hasClass('opennn');
              if (open) {
                  $_this.children('ul').removeClass('opennn');
                  $_this.children('i.icon-expand').addClass('icon-zhankai-copy').removeClass('icon-expand');
              } else {
                  $_this.children('ul').addClass('opennn');
                  $_this.children('i.icon-zhankai-copy').addClass('icon-expand').removeClass('icon-zhankai-copy');
              }
              return false;
          });
          obi.find('.searchLanM').on('keyup', function() {
            var thisKeyword = $(this).val(),
              thatVal = '',
              oldVal = $(this).data('oldVal');
            $(this).data('oldVal', thisKeyword);
            if (thisKeyword == oldVal) return;
            $addBox.html('');
            if (thisKeyword == '') {
            var newData = [];
            $.each(e, function(i, j) {
              newData.push(j);
            });
            circulationTree(newData);
            return;
            }
            $.each(newArr, function(i, j) {
              thatVal = j.display.indexOf(thisKeyword);
              if (thatVal > -1) {
                  $addBox.append('<li class="' + j.id + '" data-val="' + j.value + '" style="cursor:pointer;">' +
                        '<i class="iconfont icon-qiyong" style="margin-right:5px;"></i>' + j.display +
                        '<ul class="children_' + j.id + ' mL15 opennn"></ul>' +
                        '</li>').children(':last-child').data('info', j);
              };
            });
          });
          $(document).on("click",function(e) { 
            if($(e.target).closest(".bbox").length == 0) { 
              obi.find('.treeBox').addClass('opennn'); 
            } 
          });
          if (opts.default) {
            var thisIds = opts.default;
              thisIds = thisIds.split(',');
            $.each(thisIds, function(i, j) {
              $addBox.find('.tree' + j).click();
              $addBox.find('.tree' + j).parents("ul").removeClass("opennn");
              $addBox.find('.tree' + j).parents("li").children(".icon-expand").removeClass("icon-expand").addClass("icon-zhankai-copy");
            });
          }
      }
      
      if (typeof (callback) == "function") {
        callback(obj);
      }
     }	
    });
  } else {
    if (opts.type == "select") {
      d = opts.disabled ? "disabled" : "";
      if (obj.hasClass("required")) {
        obj.removeClass("required");
        h += '<select ' + d + ' name=' + opts.asName + ' id=' + opts.asName + 'st  class="required" placeholder="' + validate.placeholder + '" data-tip="' + validate["data-tip"] + '" data-valid="' + validate["data-valid"] + '" data-error="' + validate["data-error"] + '">';
      } else {
        h += '<select ' + d + ' name=' + opts.asName + ' id=' + opts.asName + 'st >';
      }
      for (var i = 0; i < opts.list.length; i++) {
        var at = opts.list[i].attr1?opts.list[i].attr1:"";
        s = opts.list[i].value == opts.default ? "selected" : "";
        h += '<option nextcode="'+at+'" value="' + opts.list[i].value + '"  ' + s + '>' + opts.list[i].display + '</option>';
      }
      h += '</select>';
      obj.append(h);
      $('select[name=' + opts.asName + ']').selectseach();
    } else if (opts.type == "radio") {
      for (var i = 0; i < opts.list.length; i++) {
        s = opts.list[i].value == opts.default ? "checked" : "";
        d = opts.disabled ? "disabled" : "";
        h += '<label class="rad"><input type="radio" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
      }
      obj.append(h);
    } else if (opts.type == "checkbox") {
      var v;
      if (opts.default != "" && opts.default != undefined) {
        v = opts.default.split(",");
      } else {
        v = "";
      }
      for (var i = 0; i < opts.list.length; i++) {
        $.each(v, function (n, d) {
          if (d == opts.list[i].value) {
            s = "checked";
            return false;
          } else {
            s = "";
          }
        });
        d = opts.disabled ? "disabled" : "";
        var html="";
        if(opts.list[i].hredPic!= null && opts.list[i].hredPic!=''){
          html = "<lable><img src = '"+opts.list[i].hredPic+"' class='imgRenyuan'></lable>"
        }
        h += '<label class="chk checkboxAll">'+html+'<input type="checkbox" value="' + opts.list[i].value + '" name="' + opts.asName + '" ' + s + ' ' + d + '><b></b>' + opts.list[i].display + '</label>';
      }
      obj.append(h);
    } else if (opts.type == "screen") {
      d = opts.disabled ? "disabled" : "";
      h += '<div class="label">' + opts.label + '</div><ul class="screen">';
      if (d == "") {
        h += '<li><label><input name="' + opts.asName + '" type="radio" checked value =""><b>全部</b></label></li>';
      }
      for (var i = 0; i < opts.list.length; i++) {
        s = opts.list[i].value == opts.default ? "checked" : "";
        h += '<li><label><input name="' + opts.asName + '" type="radio" ' + s + ' ' + d + ' value = "' + opts.list[i].value + '"><b>' + opts.list[i].display + '</b></label></li>';
      }
      h += '</ul>';
      obj.append(h);
    } else if (opts.type == "tree") {
      return false;
        obj.hide();
        obj.after('<div class="thisbox"></div>');
        var edata = [],
          newArr = [];
        $.each(opts.list, function(i, j) {
          edata.push(j);
          newArr.push(j);
        });
        var plach = validate.placeholder ? validate.placeholder : '';
        h = '<div class="bbox" style="position:relative;width:100%;">' +
          '<div class="ipt dm sbox" style="position:relative;display:block;width:100%;max-width:100%;min-width:100%;margin:0;">' +
          '<span class="mm zhankai"></span>' +
          '<nobr>';
        if (obj.hasClass("required")) {
          obj.removeClass("required");
          h+='<input class="chooseData required" type="text" readonly style="width:100%;height:24px;padding:10px 0;cursor:default;" name="' + opts.asName + '" maxlength="' + opts.maxlength + '" placeholder="' + plach + '"  data-valid="'+validate["data-valid"]+'" data-error="'+validate["data-error"]+'"/>' ;
        }
        else {

          h+='<input class="chooseData" type="text" readonly style="width:100%;height:24px;padding:10px 0;cursor:default;" name="' + opts.asName + '" maxlength="' + opts.maxlength + '" placeholder="' + plach + '"/>';
        }
      
        h+=	'</nobr>' +
          '</div>' +
          '<div class="treeBox opennn" style="position:absolute;margin-top: 1px;width:100%;height: 300px;overflow: scroll;border: 1px #ccc solid;border-radius: 2px;z-index: 999;background-color: #fff;">' +
          '<div style="height:34px;line-height:34px;padding:0 8px;font-size:14px;border-bottom:1px solid #d4dce5;background-color:#fff;">' +
          '<input class="searchLanM" type="text" style="width:93%;height:90%;" placeholder="请输入栏目名称" /><i class="iconfont icon-search pointer"></i>' +
          '</div>' +
          '<ul class="treeList" style="padding-left:5px;margin-top:5px;"></ul>' +
          '</div>' +
          '</div>';
        obi = obj.next('.thisbox');
        obi.append(h);
        if (opts.list.length == 0) return;
        var thmaxlength = opts.maxlength == '' ? 200 : opts.maxlength;
          var $addBox = obi.find('ul.treeList');
          var circulationTree = function(data) {
              var j = data[0];
                var $parent = $addBox.find('.children_' + j.parentId);
              var goAppend = function($box) {
                  $box.append('' +
                      '<li class="tree' + j.value + '" data-val="' + j.value + '"><i class="iconfont icon-expand node" style="margin-right:5px;"></i>' +
                      '<i class="iconfont icon-qiyong" style="margin-right:5px;"></i>' + j.display +
                      '<ul class="children_' + j.id + ' mL15 opennn"></ul>' +
                      '</li>').children(':last-child').data('info', j);
                  data.splice(0, 1);
              }
              if (j.parentId && $parent.length > 0) {
                  goAppend($parent);
               } else {
                  goAppend($addBox);
              };
              //还有数据时，继续执行
              if (data.length > 0) {
                  circulationTree(data);
              };
              var treeListLi = $addBox.find('li');
              $.each(treeListLi, function(i, j) {
              if ($(this).find('ul li').length > 0) {

              } else {
                $(this).addClass('isLeaf');
                $(this).find('i.node').addClass('hideee');
              }
            });
            // $.each(treeListLi, function(i, j) {
            // 	$(this).find('ul li').length > 0 ? '' : $(this).find('i.node').addClass('hideee');
            // });
          };
          circulationTree(edata);
          var stopBubble = function(e) {
              if (e && e.stopPropagation) {      　　
                  e.stopPropagation();
              } else {
                  window.event.cancelBubble = true;
                  return false;
              }
          };
        $addBox.on("mouseover mouseout", 'li', function(event) {
          stopBubble(event);
              if (event.type == "mouseover") {
                  $(this).addClass('hovered');
              } else if (event.type == "mouseout") {
                  $(this).removeClass('hovered');
              }
          });
          console.log(opts.onlyLeaf)
          if (opts.onlyLeaf) {
            $addBox.on("click", 'li.isLeaf', function(event) {
            stopBubble(event);
            var choosed = $(this).hasClass('choosed'),
              info = $(this).data('info'),
              $thisInput = $(this).parents('.bbox').find('.chooseData'),
              cdata = $thisInput.val(),
              cval = $thisInput.attr('data-val');
            var hasNu = cval ? cval.split(',') : '';
            if (choosed) {
              $(this).removeClass('choosed');
              var arrd = cdata.split(','),
                arrv = cval.split(',');
              $.each(arrv, function(i, j) {
                if (info.value == j) {
                  arrv.splice($.inArray(j, arrv), 1);
                }
                cval = arrv.join(',');
                $thisInput.attr('data-val', cval);
              });
              $.each(arrd, function(i, j) {
                if (info.display == j) {
                  arrd.splice(arrd.indexOf(j), 1);
                  cdata = arrd.join(',');
                  $thisInput.val(cdata);
                  return false;
                }
              });
            } else {
              if (opts.choice || thmaxlength == 1) {
                $thisInput.val(info.display);
                $thisInput.attr('data-val', info.value);
                $addBox.find('li').removeClass('choosed');
                $(this).addClass('choosed');
              } else {
                if (hasNu.length == thmaxlength) {
                  ly.toast("最大允许选择数为" + opts.maxlength);
                } else {
                  $(this).addClass('choosed');
                  if (cdata == '') {
                    $thisInput.val(info.display);
                    $thisInput.attr('data-val', info.value);
                  } else {
                    cdata += ',' + info.display;
                    cval += ',' + info.value;
                    $thisInput.val(cdata);
                    $thisInput.attr('data-val', cval);
                  }
                }
              }
            }
              
              $thisInput.blur();
          });
          } else {
            $addBox.on("click", 'li', function(event) {
            stopBubble(event);
            var choosed = $(this).hasClass('choosed'),
              info = $(this).data('info'),
              $thisInput = $(this).parents('.bbox').find('.chooseData'),
              cdata = $thisInput.val(),
              cval = $thisInput.attr('data-val');
            var hasNu = cval ? cval.split(',') : '';
            if (choosed) {
              $(this).removeClass('choosed');
              var arrd = cdata.split(','),
                arrv = cval.split(',');
              $.each(arrv, function(i, j) {
                if (info.value == j) {
                  arrv.splice($.inArray(j, arrv), 1);
                }
                cval = arrv.join(',');
                $thisInput.attr('data-val', cval);
              });
              $.each(arrd, function(i, j) {
                if (info.display == j) {
                  arrd.splice(arrd.indexOf(j), 1);
                  cdata = arrd.join(',');
                  $thisInput.val(cdata);
                  return false;
                }
              });
            } else {
              if (opts.choice || thmaxlength == 1) {
                $thisInput.val(info.display);
                $thisInput.attr('data-val', info.value);
                $addBox.find('li').removeClass('choosed');
                $(this).addClass('choosed');
              } else {
                if (hasNu.length == thmaxlength) {
                  ly.toast("最大允许选择数为" + opts.maxlength);
                } else {
                  $(this).addClass('choosed');
                  if (cdata == '') {
                    $thisInput.val(info.display);
                    $thisInput.attr('data-val', info.value);
                  } else {
                    cdata += ',' + info.display;
                    cval += ',' + info.value;
                    $thisInput.val(cdata);
                    $thisInput.attr('data-val', cval);
                  }
                }
              }
            }
              
              $thisInput.blur();
          });
          }
          
          obi.find('.sbox').on('click', function(event) {
            var $thisTree = $(this).siblings('.treeBox'),
              showO = $thisTree.hasClass('opennn');
            showO ? $thisTree.removeClass('opennn') : $thisTree.addClass('opennn');
          });
          $addBox.on('click', 'li i.node', function(event) {
              stopBubble(event);
              var tagName = event.target.tagName,
                  $_this = tagName == 'LI' ? $(event.target) : $(event.target).parent(),
                  open = $_this.children('ul').hasClass('opennn');
              if (open) {
                  $_this.children('ul').removeClass('opennn');
                  $_this.children('i.icon-expand').addClass('icon-zhankai-copy').removeClass('icon-expand');
              } else {
                  $_this.children('ul').addClass('opennn');
                  $_this.children('i.icon-zhankai-copy').addClass('icon-expand').removeClass('icon-zhankai-copy');
              }
              return false;
          });
          obi.find('.searchLanM').on('keyup', function() {
            var thisKeyword = $(this).val(),
              thatVal = '',
              oldVal = $(this).data('oldVal');
            $(this).data('oldVal', thisKeyword);
            if (thisKeyword == oldVal) return;
            $addBox.html('');
            if (thisKeyword == '') {
            var newData = [];
            $.each(e, function(i, j) {
              newData.push(j);
            });
            circulationTree(newData);
            return;
            }
            $.each(newArr, function(i, j) {
              thatVal = j.display.indexOf(thisKeyword);
              if (thatVal > -1) {
                  $addBox.append('<li class="' + j.id + '" data-val="' + j.value + '" style="cursor:pointer;">' +
                        '<i class="iconfont icon-qiyong" style="margin-right:5px;"></i>' + j.display +
                        '<ul class="children_' + j.id + ' mL15 opennn"></ul>' +
                        '</li>').children(':last-child').data('info', j);
              };
            });
          });
          $(document).on("click",function(e) { 
            if($(e.target).closest(".bbox").length == 0) { 
              obi.find('.treeBox').addClass('opennn'); 
            } 
          });
          if (opts.default != '') {
            var thisIds = opts.default;
              thisIds = thisIds.split(',');
            $.each(thisIds, function(i, j) {
              $addBox.find('.tree' + j).click();
              $addBox.find('.tree' + j).parents("ul").removeClass("opennn");
              $addBox.find('.tree' + j).parents("li").children(".icon-expand").removeClass("icon-expand").addClass("icon-zhankai-copy");
            });
            console.log(thisIds)
          }
      }
    
      if (typeof (callback) == "function") {
        callback(obj);
      }
  }
};

$.fn.selectseach = function (full) {
  if ($(this).prop("disabled")) {
    $(this).hide();
    var t = $(this).children("option:selected").text();
    var h = '<div class="ipt dm dis"><span class="mm"></span>' + t + "</div>";
    $(this).after(h)
  } else {
    var select_id = $(this).attr("id");
    var d = "#selectclassdiv",
      o = "#0080FF",
      l = "White",
      Y = "#selectdivtree" + select_id,
      s = false,
      z = ".selectimg",
      e = "#selectcontent" + select_id,
      p = "",
      n = "src",
      a = "#",
      D = "option:selected",
      k = "id",
      I = "selectinputname",
      r = "selectinput",
      X = "ZY",
      H = "YW",
      S = "DC",
      R = "YQ",
      C = "XJ",
      W = "ZD",
      G = "A",
      y = "XH",
      x = "HG",
      Q = "YX",
      u = "ZS",
      w = "JG",
      P = "XS",
      F = "XQ",
      B = "PF",
      K = "KG",
      V = "YS",
      g = "PB",
      Z = "CZ",
      i = "TD",
      h = "ZC",
      J = "KH",
      t = "SC",
      j = "QJ",
      T = "WM",
      c = "";
    String.prototype.trim = function () {
      return this.replace(/(^\s*)|(\s*$)/g, c)
    };

    function nb(a) {
      if (typeof a != "string") {
        return a
      }
      for (var d = [], b = 0, f = a.length; b < f; b++) {
        var g = a.charAt(b);
        d.push(xb(g))
      }
      var e = zb(d);
      return e.join(c).toLowerCase()
    }

    function xb(b) {
      var a = b.charCodeAt(0);
      if (a > 40869 || a < 19968) {
        return b
      }
      return jb[a] ? jb[a] : qb.charAt(a - 19968)
    }

    function zb(i) {
      for (var a = [c], f = 0, k = i.length; f < k; f++) {
        var d = i[f],
          h = d.length;
        if (h == 1) {
          for (var b = 0; b < a.length; b++) {
            a[b] += d
          }
        } else {
          var j = a.slice(0);
          a = [];
          for (b = 0; b < h; b++) {
            for (var e = j.slice(0), g = 0; g < e.length; g++) {
              e[g] += d.charAt(b)
            }
            a = a.concat(e)
          }
        }
      }
      return a
    }
    var qb = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJHHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPCBZJJBRCFTLECZSTZFXXZHTRQHYBDtLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZXYALMELDCCXGZYRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXPJBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCSKDZCTBZHYZZYYJXZCFFZZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCSHZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNCLLLKBYBZZSYHQQLTWLCCXTXLLZNTYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTG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AYYOCZLYLBSZYWJYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLXYJZYZYYPNHMYMDYYLBLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJLJXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQDCYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHWWKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJXY",
      jb = {
        "19969": "DZ",
        "19975": T,
        "19988": j,
        "20048": "YL",
        "20056": t,
        "20060": "NM",
        "20094": "QG",
        "20127": j,
        "20167": "QC",
        "20193": "YG",
        "20250": J,
        "20256": h,
        "20282": t,
        "20285": "QJG",
        "20291": i,
        "20314": "YD",
        "20340": "NE",
        "20375": i,
        "20389": "YJ",
        "20391": Z,
        "20415": g,
        "20446": V,
        "20447": "SQ",
        "20504": "TC",
        "20608": K,
        "20854": j,
        "20857": h,
        "20911": B,
        "20504": "TC",
        "20608": K,
        "20854": j,
        "20857": h,
        "20911": B,
        "20985": "AW",
        "21032": g,
        "21048": F,
        "21049": t,
        "21089": V,
        "21119": "JC",
        "21242": "SB",
        "21273": t,
        "21305": "YP",
        "21306": "QO",
        "21330": h,
        "21333": "SDC",
        "21345": "QK",
        "21378": "CA",
        "21397": t,
        "21414": P,
        "21442": t,
        "21477": w,
        "21480": i,
        "21484": u,
        "21494": Q,
        "21505": Q,
        "21512": x,
        "21523": y,
        "21537": g,
        "21542": B,
        "21549": J,
        "21571": "E",
        "21574": "DA",
        "21588": i,
        "21589": "O",
        "21618": h,
        "21621": "KHA",
        "21632": "ZJ",
        "21654": K,
        "21679": "LKG",
        "21683": J,
        "21710": G,
        "21719": "YH",
        "21734": "WOE",
        "21769": G,
        "21780": "WN",
        "21804": y,
        "21834": G,
        "21899": W,
        "21903": "RN",
        "21908": "WO",
        "21939": h,
        "21956": "SA",
        "21964": "YA",
        "21970": i,
        "22003": G,
        "22031": w,
        "22040": P,
        "22060": h,
        "22066": h,
        "22079": "MH",
        "22129": C,
        "22179": "XA",
        "22237": "NJ",
        "22244": i,
        "22280": "JQ",
        "22300": "YH",
        "22313": "XW",
        "22331": R,
        "22343": "YJ",
        "22351": "PH",
        "22395": S,
        "22412": i,
        "22484": g,
        "22500": g,
        "22534": W,
        "22549": "DH",
        "22561": g,
        "22612": i,
        "22771": "KQ",
        "22831": "HB",
        "22841": w,
        "22855": j,
        "22865": F,
        "23013": "ML",
        "23081": T,
        "23487": "SX",
        "23558": j,
        "23561": H,
        "23586": H,
        "23614": H,
        "23615": "SN",
        "23631": g,
        "23646": u,
        "23663": "ZT",
        "23673": "YG",
        "23762": i,
        "23769": u,
        "23780": j,
        "23884": "QK",
        "24055": y,
        "24113": S,
        "24162": h,
        "24191": "GA",
        "24273": j,
        "24324": "NL",
        "24377": i,
        "24378": j,
        "24439": B,
        "24554": u,
        "24683": i,
        "24694": "WE",
        "24733": "LK",
        "24925": "TN",
        "25094": "ZG",
        "25100": F,
        "25103": y,
        "25153": g,
        "25170": g,
        "25179": K,
        "25203": g,
        "25240": u,
        "25282": "FB",
        "25303": "NA",
        "25324": K,
        "25341": X,
        "25373": "WZ",
        "25375": C,
        "25384": G,
        "25457": G,
        "25528": "SD",
        "25530": t,
        "25552": i,
        "25774": h,
        "25874": h,
        "26044": H,
        "26080": T,
        "26292": g,
        "26333": g,
        "26355": X,
        "26366": Z,
        "26397": h,
        "26399": j,
        "26415": u,
        "26451": "SB",
        "26526": h,
        "26552": w,
        "26561": i,
        "26588": w,
        "26597": Z,
        "26629": u,
        "26638": "YL",
        "26646": F,
        "26653": K,
        "26657": C,
        "26727": x,
        "26894": h,
        "26937": u,
        "26946": h,
        "26999": "KJ",
        "27099": "KJ",
        "27449": R,
        "27481": P,
        "27542": u,
        "27663": u,
        "27748": "TS",
        "27784": t,
        "27788": W,
        "27795": i,
        "27812": "O",
        "27850": g,
        "27852": "MB",
        "27895": "SL",
        "27898": "PL",
        "27973": j,
        "27981": J,
        "27986": "HX",
        "27994": C,
        "28044": "YC",
        "28065": "WG",
        "28177": "SM",
        "28267": j,
        "28291": J,
        "28337": "ZQ",
        "28463": "TL",
        "28548": S,
        "28601": i,
        "28689": g,
        "28805": w,
        "28820": "QG",
        "28846": g,
        "28952": i,
        "28975": h,
        "29100": G,
        "29325": j,
        "29575": "SL",
        "29602": "FB",
        "30010": i,
        "30044": "CX",
        "30058": B,
        "30091": "YSP",
        "30111": "YN",
        "30229": C,
        "30427": t,
        "30465": "SX",
        "30631": R,
        "30655": j,
        "30684": "QJG",
        "30707": "SD",
        "30729": y,
        "30796": "LG",
        "30917": g,
        "31074": "NM",
        "31085": "JZ",
        "31109": t,
        "31181": h,
        "31192": "MLB",
        "31293": "JQ",
        "31400": Q,
        "31584": "YJ",
        "31896": "ZN",
        "31909": X,
        "31995": C,
        "32321": B,
        "32327": X,
        "32418": x,
        "32420": F,
        "32421": x,
        "32438": "LG",
        "32473": "GJ",
        "32488": i,
        "32521": j,
        "32527": g,
        "32562": "ZSQ",
        "32564": "JZ",
        "32735": W,
        "32793": g,
        "33071": B,
        "33098": "XL",
        "33100": "YA",
        "33152": g,
        "33261": "CX",
        "33324": "BP",
        "33333": i,
        "33406": "YA",
        "33426": T,
        "33432": g,
        "33445": w,
        "33486": "ZN",
        "33493": "TS",
        "33507": j,
        "33540": j,
        "33544": h,
        "33564": F,
        "33617": "YT",
        "33632": j,
        "33636": y,
        "33637": Q,
        "33694": "WG",
        "33705": B,
        "33728": H,
        "33882": "SR",
        "34067": T,
        "34074": H,
        "34121": j,
        "34255": h,
        "34259": "XL",
        "34425": "JH",
        "34430": y,
        "34485": J,
        "34503": V,
        "34532": x,
        "34552": P,
        "34558": "YE",
        "34593": "ZL",
        "34660": R,
        "34892": y,
        "34928": t,
        "34999": j,
        "35048": g,
        "35059": t,
        "35098": h,
        "35203": "TQ",
        "35265": "JX",
        "35299": "JX",
        "35782": "SZ",
        "35828": V,
        "35830": "E",
        "35843": i,
        "35895": "YG",
        "35977": "MH",
        "36158": w,
        "36228": j,
        "36426": F,
        "36466": S,
        "36710": "JC",
        "36711": "ZYG",
        "36767": g,
        "36866": "SK",
        "36951": H,
        "37034": Q,
        "37063": y,
        "37218": h,
        "37325": h,
        "38063": g,
        "38079": i,
        "38085": "QY",
        "38107": S,
        "38116": i,
        "38123": "YD",
        "38224": x,
        "38241": "XTC",
        "38271": h,
        "38415": "YE",
        "38426": J,
        "38461": "YD",
        "38463": "AE",
        "38466": g,
        "38477": C,
        "38518": "YT",
        "38551": "WK",
        "38585": h,
        "38704": P,
        "38739": "LJ",
        "38761": "GJ",
        "38808": "SQ",
        "39048": w,
        "39049": C,
        "39052": x,
        "39076": Z,
        "39271": "XT",
        "39534": i,
        "39552": i,
        "39584": g,
        "39647": "SB",
        "39730": "LG",
        "39748": "TPB",
        "40109": "ZQ",
        "40479": "ND",
        "40516": x,
        "40536": x,
        "40583": j,
        "40765": R,
        "40784": j,
        "40840": "YK",
        "40863": "QJG"
      },
      mb, kb = $(this),
      m, Ab, cb = 12,
      eb, fb, A, wb, lb, ab, L = r,
      q = I,
      bb = "imgselect",
      ob, b, pb, gb = c,
      N = c,
      f = -1,
      E = 1,
      v, U = -10;
    kb.each(function () {
      m = $(this);
      var a = m.attr("m");
      cb = 12;
      eb = m.offset().left;
      fb = m.offset().top;
      A = m.width();
      b = m.attr(k);
      wb = m.val();
      lb = m.find(D).text();
      mb = mb + "left=" + eb + "and top=" + fb + "<br>";
      if (/firefox|chrome/.test(navigator.userAgent.toLowerCase())) {
        ab = A - 15
      } else {
        ab = A - 18
      }
      sb()
    });
    kb.each(function () {
      $(this).hide();
      $(this).bind("propertychange", function () {
        if (event.propertyName != "value") {
          return
        }
        if ($("#" + q + b).val() != this.value) {
          $("#" + q + b).val($(this).find('option[value="' + this.value + '"]').html())
        }
      })
    });

    function sb() {
      ob = "<div id=" + L + b + " class='ipt dm' style='position: relative; display: block;width: 100%;max-width: 100%;min-width: 100%;    margin: 0;'><span class='mm'></span><nobr><input  type='text' name=" + q + b + " id=" + q + b + " style='width:100%; height:24px; padding:10px 0;'/></nobr></div>";
      if (!$(a + L + b).html()) {
        m.after(ob);
        ub()
      }
      $(a + L + b).css({});
      $(a + q + b).css({
        "cursor": "default"
      });
      $(a + q + b).val(lb);
      $(a + q + b).focus(function () {
        var d;
        d = $(this).attr(k);
        b = d.replace(I, c);
        m = $(a + L + b)
      });
      $(a + q + b).blur(function () {
        var d;
        d = $(this).attr(k);
        b = d.replace(I, c);
        $(a + q + b).val($(a + b).find(D).text());
        $(a + bb + b).attr(n, p)
      });
      $(a + L + b).show();
      $(a + L + b).click(function () {
        m = $(this);
        if (!m.hasClass("open")) {
          M();
          m.addClass("open");
        }
        else {
          m.removeClass("open");
          b = $(this).attr(k);
          b = b.replace(r, c);
          $(a + q + b).val($(a + b).find(D).text());
          $(a + bb + b).attr(n, p);
          $(e).remove()
        }
        return false;
      });
    }
    $("body").click(function(){
        $(".dm.open").removeClass("open");
        $(e).remove()
    });
    function M() {
      var d;
      $(".dm.open").removeClass("open");
      b = m.attr(k);
      b = b.replace(r, c);
      $(z).attr(n, p);
      $(a + bb + b).attr(n, "");
      $(a + q + b).focus();
      A = m.width();
      if (/firefox|chrome/.test(navigator.userAgent.toLowerCase())) {
        A = A + 16
      } else {
        A = A + 20
      }
      var f = "<div id='selectcontent" + select_id + "' style=' position:absolute;text-align:left; border: 1px solid #CCC; background:white; overflow-x:hidden;overflow-y:auto;margin: -1.5pt 0px 0pt -1px;z-index:99999'></div>";
      $(e).remove();
      m.append(f);
      var pOffset = $(e).offsetParent().offset();
      var selectInput = $("#" + L + b);
      $(e).css({
        "font-size": cb,
        width: m.outerWidth(),
        left: selectInput.offset().left - pOffset.left,
        top: selectInput.offset().top + selectInput.outerHeight() - pOffset.top
      });
      $(e).show();
      ib(0);
      if (v <= 8) {
        d = v * 30 + 5
      } else {
        d = 240
      }
      $(e).css({
        height: d
      })
    }

    function vb(b, c) {
      for (var a = 0; a < b.length; a++) {
        if (b[a] == c) {
          return s
        }
      }
      return true
    }

    function ib(o) {
      b = m.attr(k);
      b = b.replace(r, c);
      $(a + b).find("option").each(function () {
        gb = gb + $(this).val() + "|";
        N = N + $(this).text() + "|"
      });
      var d = c,
        p = $(a + q + b).val(),
        l = c,
        i = c,
        n = [],
        j = [];
      N = N + " ";
      j = N.split("|");
      i = $("#selectinputname" + b).val();
      if (i != c && i != "undefined") {
        if (o == 1) {
          var g = rb(i, j)
        }
        if (o == 0) {
          var g = j
        }
      } else {
        var g = j
      }
      d = "<div  id='selectdivtree" + select_id + "' style=' width:100%;border:0px solid #CCC;margin: 0;color:#000000'>";
      v = 0;
      pb = g.length;
      if (g != c) {
        for (var h = 0; h < pb; h++) {
          if (vb(n, g[h])) {
            if (g[h] != " " && g[h] != "null") {
              v = v + 1;
              if (p == g[h]) {
                U = v;
                l = "background: #0080FF; color:#fff"
              }
              d = d + "<div style='font-size:14px; height:30px; line-height:30px; word-break:keep-all;overflow-x:hidden;overflow-y:hidden; padding:0 10px;" + l + " ' class='selectclassdiv' id='selectclassdiv" + v + "' rel = '" + v + "'>" + g[h] + "</div>";
              l = c;
              n.push(g[h])
            }
          }
        }
      } else {
        d = d + "没有数据!"
      }
      d = d + "<input type='hidden'  id = 'selectaction' value = '0'></div>";
      $(Y).remove();
      $(e).html(d);
      f = -1;
      n = c;
      gb = c;
      N = c;
      O(U);
      f = U;
      U = -10;
      tb()
    }

    function rb(j, g) {
      for (var d = j, h = d.charAt(0), i = d.length, b, l = s, k = -1, a = c, f = 0; f < g.length; f++) {
        b = g[f];
        for (var e = 0; e < b.length; e++) {
          var curstr = b.charAt(e);
          if (curstr == h || nb(curstr).indexOf(h) >= 0) {
            strsearch = b.substring(e).substring(0, i);
            strsearch1 = nb(strsearch);
            if (strsearch == d || strsearch1.indexOf(d) >= 0) {
              a = a + b + "|"
            }
          }
        }
      }
      if (a.length > 1) {
        a = a.substring(0, a.length - 1)
      }
      var a = a.split("|");
      a.sort();
      return a
    }

    function tb() {
      var d = ".selectclassdiv";
      b = m.attr(k);
      b = b.replace(r, c);
      var f = $(Y);
      f.find(d).each(function () {
        var c = $(this);
        c.click(function () {
          hb(c.html());
          $(a + b).change();
          $(e).hide();
          $(z).attr(n, p);
          $(a + b).focus();
          $(a + b).blur();
        });
        c.hover(function () {
          db(c.html()) != $(a + b).val() && f.find(d).css({
            background: l,
            color: "#000"
          });
          $(this).css({
            background: o,
            color: "#fff"
          })
        }, function () {
          db(c.html()) != $(a + b).val() && $(this).css({
            background: l,
            color: "#000"
          })
        })
      });
      $(a+b).off("change")
      var oldStr = $(a + b).children('option:selected').text();
      $(a + b).change(function(){
        var newStr = $(this).children('option:selected').text();
        if(newStr!=oldStr){
          boolean = true;
          //console.log(newStr);
        }
      });

    }

    function db(e) {
      b = m.attr(k);
      b = b.replace(r, c);
      var d = c;
      $(a + b).find("option").each(function () {
        if (e == $(this).text()) {
          d = $(this).val();
          return s
        }
      });
      return d
    }

    function hb(d) {
      b = m.attr(k);
      b = b.replace(r, c);
      if ($(e).length == 0) {
        return s
      }
      $(a + b).val(db(d));
      $(a + q + b).val(d)
    }

    function yb(a) {
      var b;
      return a * 14 - 23
    }

    function O(a) {
      if (a < 1) {
        return s
      }
      if (a > v) {
        return s
      }
      var b = yb(a),
        c = $(e).scrollHeight;
      $(e).attr("scrollTop", b);
      $("#selectaction").val($(d + a).attr("rel"));
      hb($(d + a).html())
    }

    function ub() {
      $(a + q + b).keyup(function (c) {
        if (v < f) {
          f = 0
        }
        if (f < 1) {
          f = 0
        }
        E = 1;
        switch (c.keyCode) {
          case 37:
            E = 0;
            M();
            $(d + f).css({
              background: l,
              color: "#000"
            });
            f = f - 1;
            O(f);
            $(d + f).css({
              background: o,
              color: "#fff"
            });
            break;
          case 39:
            E = 0;
            M();
            $(d + f).css({
              background: l,
              color: "#000"
            });
            f = f + 1;
            O(f);
            $(d + f).css({
              background: o,
              color: "#fff"
            });
            break;
          case 40:
            E = 0;
            $(d + f).css({
              background: l,
              color: "#000"
            });
            f = f + 1;
            O(f);
            $(d + f).css({
              background: o,
              color: "#fff"
            });
            break;
          case 38:
            E = 0;
            M();
            $(d + f).css({
              background: l,
              color: "#000"
            });
            f = f - 1;
            O(f);
            $(d + f).css({
              background: o,
              color: "#fff"
            });
            break;
          case 13:
            E = 0;
            M();
            hb($(d + f).html());
            $(a + b).change();
            $(e).hide();
            $(z).attr(n, p);
            $(a + b).focus();
            $(a + b).blur();
            break;
          case 9:
            E = 0;
            $(e).remove()
        }
        if (E == 1) {
          M();
          ib(1)
        }
      });
      $(a + q + b).click(function () {
        $(a + q + b).select()
      })
    }
  }
};

function disp(t) {
  if (t == "" || t == "true" || t == undefined) {
    return ""
  } else if (t == "false") {
    return "none";
  }
}
//格式化日期（date，reg）
function dateFormat(now, mask) {
  if (mask == null || mask == "" || mask == undefined) {
    mask = 'yyyy-MM-dd HH:mm:ss';
  }
  var d = now;
  if (now instanceof Date) {
    d = now;
  } else {
    now = now.replace(/-/g, "/");
    d = new Date(now);
  }
  var zeroize = function(value, length) {
    if (!length) length = 2;
    value = String(value);
    for (var i = 0, zeros = ''; i < (length - value.length); i++) {
      zeros += '0';
    }
    return zeros + value;
  };

  return mask.replace(/"[^"]*"|'[^']*'|\b(?:d{1,4}|m{1,4}|yy(?:yy)?|([hHMstT])\1?|[lLZ])\b/g, function($0) {
    switch ($0) {
      case 'd':
        return d.getDate();
      case 'dd':
        return zeroize(d.getDate());
      case 'ddd':
        return ['Sun', 'Mon', 'Tue', 'Wed', 'Thr', 'Fri', 'Sat'][d.getDay()];
      case 'dddd':
        return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][d.getDay()];
      case 'M':
        return d.getMonth() + 1;
      case 'MM':
        return zeroize(d.getMonth() + 1);
      case 'MMM':
        return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()];
      case 'MMMM':
        return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][d.getMonth()];
      case 'yy':
        return String(d.getFullYear()).substr(2);
      case 'yyyy':
        return d.getFullYear();
      case 'h':
        return d.getHours() % 12 || 12;
      case 'hh':
        return zeroize(d.getHours() % 12 || 12);
      case 'H':
        return d.getHours();
      case 'HH':
        return zeroize(d.getHours());
      case 'm':
        return d.getMinutes();
      case 'mm':
        return zeroize(d.getMinutes());
      case 's':
        return d.getSeconds();
      case 'ss':
        return zeroize(d.getSeconds());
      case 'l':
        return zeroize(d.getMilliseconds(), 3);
      case 'L':
        var m = d.getMilliseconds();
        if (m > 99) m = Math.round(m / 10);
        return zeroize(m);
      case 'tt':
        return d.getHours() < 12 ? 'am' : 'pm';
      case 'TT':
        return d.getHours() < 12 ? 'AM' : 'PM';
      case 'Z':
        return d.toUTCString().match(/[A-Z]+$/);
      default:
        return $0.substr(1, $0.length - 2);
    }
  });
}

/**
 *	验证表单
 */
$("div.validform").each(function() {
  if ($("#valid").length < 1) {
    $("body").append('<script id="valid" src="' + site.interUrl + 'js/jquery-validate.js"></script>');
  }
});
/**
 *  组合对象
 */
function getter(obj, path) { //obj：节点名,path：对象组合
  if (!path) return obj;
  var keys = path.split('.');
  var key;
  var lastInstance = obj;
  var len = keys.length;
  for (var i = 0; i < len; i++) {
    key = keys[i];
    if (obj) {
      obj = (lastInstance = obj)[key];
    }
  }
  return obj;
}
/**
 *  json键名替换
 */
var jsonArrangement = function(j, n, nn) {
  n = n.split("|");
  nn = nn.split("|");
  $.each(j, function(i, d) {
    $.each(n, function(j, e) {
      var t = d[e];
      delete d[e];
      d[nn[j]] = t;
    })
  });
  return j;
};
/**
 *  获得唯一字符串
 */
var Uniquestring = function(v) {
  var d = new Date().getTime();
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = (d + Math.random() * 16) % 16 | 0;
    d = Math.floor(d / 16);
    return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
  });
  return v + uuid;
};
/**
 *  文本框单位
 */
var showUnit = function() {
  $("[unit]").each(function() {
    var _this = $(this);
    _this.next(".unit").remove();
    _this.css("padding-right", "0");
    var u = _this.attr("unit");
    if (_this.parent().css("position") != "absolute" && !_this.parents().css("position") != "fixed") {
      _this.parent().css({
        "position": "relative",
        "font-size": "0"
      });
    }
    _this.before('<span class="unit">' + u + '</span>');
  });
};
showUnit();

/**
 *  去html格式，并截取长度
 */
var abstract = function(e, n) {
  var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
  var t = e.replace(regexp, '');
  if (t.length > n) {
    return t.substring(0, n) + "...";
  } else {
    return t;
  }
}
var comolete = false;
var lyComplete = function() {
  setDateinput(); //生成日期选择器
  showUnit(); //显示单位
  addGutter(); //间距处理
  setVideoUploader();
  iconSelector();
  comolete = true;
}
addGutter();

var stopBubble = function(e) {
  if (e && e.stopPropagation) {
    e.stopPropagation();
  } else {
    window.event.cancelBubble = true;
    return false;
  }
}

// 单点地图选择器
$.fn.singleMapSelector = function(options, callback) {
  var _this = $(this);
  var inInfo = '',
    code = '';
  if (_this.attr('type') != 'btnMap' && _this.attr('type') != 'inputMap') {
    return;
  }
  if (options) {
    if (options.code) {
      code = options.code;
    }
    inInfo = JSON.stringify(options);
  }
  _this.unbind("click");
  if (_this.attr('type') == 'btnMap') {
    _this.after('<div class="addrs-list"></div>');
    loadData();
    _this.next('.addrs-list').on('click', 'div>i.del', function() {
      var $thisDiv = $(this).parent();
      $thisDiv.remove();
    });
    _this.next('.addrs-list').on('click', 'div>img', function() {
      var address = $(this).siblings('span').text();
      var lng = $(this).siblings('label:eq(0)').text();
      var lat = $(this).siblings('label:eq(1)').text();
      var inInfo = {
        address: address,
        lng: lng,
        lat: lat
      };
      $(this).parents("body").prepend('<iframe class="showMapSelector-iframe" ininfo=\'' + JSON.stringify(inInfo) + '\' style="width:100%;height:100%;position:fixed;top: 0;left: 0;z-index:9999;" src="' + site.interUrl + '/js/mapSelector/showmap.html" frameborder="0"></iframe>');
    });
  }
  _this.click(function() {
    _this.parents("body").prepend('<iframe class="singleMapSelector-iframe" ininfo=\'' + inInfo + '\' style="width:100%;height:100%;position:fixed;top: 0;left: 0;z-index:9999;" src="' + site.interUrl + '/js/mapSelector/single.html" frameborder="0"></iframe>');
    var $obj = _this.parents("body").find(".singleMapSelector-iframe");
    $obj[0].onload = function() {
      var $thisDom = $(this.contentWindow.document);
      //关闭弹窗
      $thisDom.find(".btnBox .btn-return").on('click', function() {
        $obj.remove();
        return;
      });
      //提交数据
      $thisDom.find(".btnBox").on('click', '.btn-submit.submit', function() {
        $thisDom.find(".tip input").animate({ width: "0px", paddingLeft: "0px", paddingRight: "0px" }, 10);
        $thisDom.find('.tip span').addClass('none');
        $thisDom.find('.btn-submit').addClass('editAdd').removeClass('submit');
        var data = JSON.parse($obj.data('outInfo'));
        if (_this.attr('type') == 'inputMap') {
          if (typeof(callback) == "function") {
            callback(data);
            $thisDom.find(".btnBox .btn-return").click();
          }
        } else if (_this.attr('type') == 'btnMap') {}
      });
    };
  });
};

//icon选择器
function iconSelector() {
  $("input[type=icon]").each(function(e) {
    if ($("#selector").length < 1) {
      $("#sy_main_js").before('<script id="selector" src="' + site.interUrl + '/js/selector.js"></script>');
    }
    $(this).next(".icon_selector").remove();
    var select = '<div class="icon_selector">';
    select += '<div class="selector_pop">';
    select += '<span class="selected">';
    select += '<i class="iconfont-guangming" title="" icontit=""></i>';
    select += '</span>';
    select += '<span class="selector_button">';
    select += '<i class="iconfont-guangming icon-xiala" title="icon-xiala" icontit=""></i>';
    select += ' </span>';
    select += '</div>';
    select += '<div class="selectort" style="display: none">';
    select += '<input type="text"  name="" value="" placeholder="搜索图标" class="selector_find" id="selecticonid' + e + '"  ">';
    select += '<span class="selected-icon">';
    select += '</span>';
    select += '</div>';
    select += '</div>';
    var _this = $(this);
    _this.hide();
    _this.after(select);
    var v = _this.val();
    var icontype = _this.attr("icontype");
    if (icontype) {
      $(".selected").html('<i class="iconfont-guangming" title="' + v + '" iconcode="' + v + '"> ' + v + '</i>')
    } else {
      $(".selected").html('<i class="iconfont-guangming ' + v + '" title="' + v + ' "></i>')
    }

    var data;
    var url = site.interUrl + "js/json/icon.json";
    var ht = '<span class="l_box"><i class="" title="" icontit=""></i></span>'
    request({
      url: url,
      data: data,
      type: "get",
      callback: function(e) {
        for (var i = 0; i < e.list.length; i++) {
          ht += '<span class="l_box"><i class="iconfont-guangming ' + e.list[i]["name"] + '" title="' + e.list[i]["name"] + '" iconCode="' + e.list[i]["code"] + '" icontit="' + e.list[i]["cnname"] + '"></i></span>'
        }
        $(".selected-icon").append(ht);
      }
    });
    $("#selecticonid" + e + "").on("keyup", function() {
      var ival = $(this).val();
      var py = makePy(ival);
      var lower = py[0].toLowerCase();
      console.log(lower);
      $(".selected-icon span").each(function(s) {
        var icontitle = $(this).children("i").attr("icontit");
        var newPY = makePy(icontitle)[0].toLowerCase();
        console.log(newPY);
        if (newPY.indexOf(lower) < 0 && icontitle.indexOf(lower) < 0) {
          $(this).hide();
        } else {
          $(this).show();
        }
      })
    })
    var se = $(".selector_button");
    se.click(function() {
      $(".selectort").toggle(100);
    })
    $(".selected-icon").on("click", ".l_box", function() {
      $(".selected").html($(this).html());
      if (icontype) {
        _this.val($(this).find(".iconfont-guangming").attr("iconcode"));
      } else {
        _this.val($(this).find(".iconfont-guangming").attr("title"));
      }

      $(".selectort").hide(100);
      _this.blur();
    });
    $("body").on("click", function(e) {
      var target = $(e.target);
      if (target.closest(".selector_pop").length == 0 && target.closest(".selectort").length == 0) {
        $(".selectort").hide(100);
      }
    })
  })
}

function imgerror(ev) {
  $(ev).attr("src", "img/default_head.jpg")
}

//菜单，功能权限树
$.fn.permissionList = function(options) {
	var _this = $(this);
	console.log(_this);
	var defaults = {
		// '00c4c9d41a9742da85bb9c2881d5b9bd','01a31f58862645ebae29afaabbf8800e','0299c31c127b4fc296854ea9f95da055','0542dee043784c33b3138af39edcb11f','06438ff42b434773ae01ed98f5cbe248'
		echodataMenu: [],
		// 'score','aafc3f84065209ceb4f9378e6af19bc5'
		echodataFunc: [],
		orgId: ''
	};
	var opts = $.extend({},defaults,options);
	var ranflag = Uniquestring("ranflag");
	// var funclist = [];
	_this.html('');
	_this.append('<div class="'+ ranflag +'"><p><span>菜单：</span><label class="pr20 menus">0</label><span>功能：</span><label class="pr20 functions">0</label><button class="btn body-submit red clears">清空</button></p><div class="permission-container"></div></div>');
	$('.' + ranflag + ' .permission-container').siblings('p').css('color','#444');
	$('.' + ranflag + ' .permission-container').on('click','li',function(event){
		stopBubble(event);
		var o = event.target;
		var $this = $(this);
	    if($(o).closest('i.icon-expand,i.icon-zhankai').length==0){
	    	$this.toggleClass('choosed');
	    	$('.' + ranflag + ' .permission-container li').children('i.icon-qiyong').removeClass('half-chos');
	    	if($this.hasClass('choosed')) {
	    		$this.parents('ul.child-list').prev('li').addClass('choosed');
	    		$this.next('ul').find('li').addClass('choosed');
	    	} else {
	    		$this.next('ul').find('li').removeClass('choosed');
	    	}
	    	$('.' + ranflag + ' .menus').text($('.' + ranflag + ' .mens.choosed').length);
	    	$('.' + ranflag + ' .functions').text($('.' + ranflag + ' .funs.choosed').length);
	    	selectedOpts();
	    } else {
	    	if($this.hasClass('open')) {
				$this.removeClass('open');
		    	$this.children('.icon-zhankai').removeClass('icon-zhankai').addClass('icon-expand');
		    	$this.next('ul.child-list').hide();
		    } else {
		    	$this.addClass('open');
			   	$this.children('.icon-expand').removeClass('icon-expand').addClass('icon-zhankai');
			   	if($this.next('ul').hasClass('child-list')) {
			   		$this.next('ul.child-list').show();
			   	} else {
			   		ly.toast('该菜单下暂无项目');
			   	}
		    }
		    $('.' + ranflag + ' .permission-container').getNiceScroll().resize();
	    }
	}).siblings('p').on('click','.clears',function(){
		if($('.' + ranflag + ' .menus').text() == '0' && $('.' + ranflag + ' .functions').text() == '0') {
			ly.toast('已清空，请勿重复操作');
			return;
		}
		$('.' + ranflag + ' li.choosed').removeClass('choosed');
		$('.' + ranflag + ' .menus').text(0);
	    $('.' + ranflag + ' .functions').text(0);
	});
	//点击事件冒泡阻止
    var stopBubble = function(e) {
        //如果提供了事件对象，则这是一个非IE浏览器
        if (e && e.stopPropagation) {
            // 因此它支持W3C的stopPropagation()方法        　　
            e.stopPropagation();
        } else { //否则，我们需要使用IE的方式来取消事件冒泡
            window.event.cancelBubble = true;
            return false;
        }
    };
    $.fn.permissionList.returndata = function() {
    	var returndata = {menu:[],fun:[]};
    	$.each($('.' + ranflag + ' .mens.choosed'),function(i,item) {
	    	returndata.menu.push($(item).attr('data-id'));
	    });
	    $.each($('.' + ranflag + ' .funs.choosed'),function(j,items) {
	    	returndata.fun.push($(items).attr('data-id'));
	    });
    	return returndata;
    }
    $('.' + ranflag + ' .permission-container').html('<div class="loadings f16 pl10 c_444"><label class="pr10">数据正在加载中</label><img class="v-a-middle" src="'+ site.gateUrl +'/img/loading.gif"></div>');
	// http://192.168.30.75:8762
	requestPost(site.apiUrl + '/back/menu/selectMenuAllThisMenu',{orgId: (opts.orgId ? opts.orgId : '')},function(r){
		console.log(r);
		if(r.code == 'success') {
			var data = r.result;
			if(data.menu.length > 0 && data.menu[0]['m1'].length > 0) {
				if($('#jquery_nicescroll').length == 0) {
					$("body").append('<script id="jquery_nicescroll" src="' + site.gateUrl + '/js/jquery.nicescroll/jquery.nicescroll.min.js"></script>');
				}
				$('.' + ranflag + ' .permission-container').niceScroll({
			        cursorcolor: "#d9d9d9",
			        cursorwidth: "8px",
			        cursorborderradius: 0,
			        cursorborder: 0
			    });
			    $('.' + ranflag + ' .permission-container .loadings').remove();
				showdata(data.menu[0],data.func);
				$('.' + ranflag + ' .permission-container').getNiceScroll().resize();
			} else {
				$('.' + ranflag + ' .permission-container').css({
					'overflow':'hidden',
					'border':'none'
				});
				$('.' + ranflag + ' .permission-container').html('<div class="nodata"><img src="'+ site.gateUrl +'/img/nodata.png"><p>暂无数据</p></div>');
			}
		} else {
			ly.toast('获取数据失败');
		}
	},'post');

	function showdata(menulist) {
		var $obj = $('.' + ranflag + ' .permission-container');
		for(var i = 1; i <= Object.keys(menulist).length; i++) {
			$.each(menulist['m'+i],function(j,item) {
				var ischosed = opts.echodataMenu.indexOf(item.id) == -1 ? '' : 'choosed open';
				if(opts.echodataMenu.length == 0 && opts.echodataFunc.length == 0 && opts.orgId) {
					ischosed = 'choosed open';
				}
				var exorzhan = opts.echodataMenu.indexOf(item.id) == -1 ? 'icon-expand' : 'icon-zhankai';
				var leaf = item.parentNum == 0 ? true : false;
				var _url = item.url ? '</label><label>url：'+ item.url +'</label>' : '';
				var roots = i == 1 ? 'roots' : '';
				if(i != 1) {
					if($('.' + ranflag + ' li[data-id='+ item.parentId +']').next('ul.child-list').length == 0){
						var s_h = $('.' + ranflag + ' li[data-id='+ item.parentId +']').is('.open') ? '' : 'hide';
						$('.' + ranflag + ' li[data-id='+ item.parentId +']').after('<ul class="child-list '+ s_h +'"></ul>');
					}
					$obj = $('.' + ranflag + ' li[data-id='+ item.parentId +']').next('ul.child-list');
				}
				$obj.append('<li class="mens '+ roots +' '+ ischosed +'" data-id="'+ item.id +'" isleaf="'+ leaf +'"><i class="iconfont '+ exorzhan +'"></i><i class="iconfont icon-qiyong"></i>【菜单】<label class="pr10">'+ item.menuName  +'</li>');//+ _url
			});
		}
// 		$.each(funclist,function(i,item){
// 			var ischosed = opts.echodataFunc.indexOf(item.id) == -1 ? '' : 'choosed';
// 			if(opts.echodataMenu.length == 0 && opts.echodataFunc.length == 0 && opts.orgId) {
// 				ischosed = 'choosed open';
// 			}
// 			var _uri = item.uri ? '</label><label>url：'+ item.uri +'</label>' : '';
// 			if(item && item.menuId) {
// 				if($('.' + ranflag + ' li[data-id='+ item.menuId +']').next('ul.child-list').length == 0) {
// 					$('.' + ranflag + ' li[data-id='+ item.menuId +']').after('<ul class="child-list"></ul>');
// 				}
// 				var $el = $('.' + ranflag + ' li[data-id='+ item.menuId +']').next('ul.child-list');
// //				$el.append('<li class="funs '+ ischosed +'" data-id="'+ item.id +'" isleaf="true"><i class="iconfont icon-qiyong"></i>【功能】<label class="pr10">'+ item.funcName + _uri +'</li>');
// 				$el.append('<li class="funs '+ ischosed +'" data-id="'+ item.id +'" isleaf="true"><i class="iconfont icon-qiyong"></i>【功能】<label class="pr10">'+ item.funcName +'</li>');
// 			}
// 		});

		$('.' + ranflag + ' .menus').text($('.' + ranflag + ' .mens.choosed').length);
	    $('.' + ranflag + ' .functions').text($('.' + ranflag + ' .funs.choosed').length);

	    //全选中与半选中的区分
		selectedOpts();
	}

	function selectedOpts() {
		$.each($('.' + ranflag + ' li.choosed'),function(i,item) {
			if($(item).next('ul.child-list').length == 1) {
				if($(item).next('ul').find('li').length != $(item).next('ul').find('li.choosed').length) {
					$(item).children('i.icon-qiyong').addClass('half-chos');
				}
			}
		})
	}
}